# Matrix algebra

**URL:** <https://community.wolfram.com/t/matrix-algebra/14305>\
**Category:** Questions\
**Created:** [July 2, 2019, 7:57am UTC](https://community.wolfram.com/t/matrix-algebra/14305 "2019-07-02T07:57:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajnitdgp2007](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rajnitdgp2007](https://community.wolfram.com/u/rajnitdgp2007)\
**Post date:** [July 2, 2019, 7:57am UTC](https://community.wolfram.com/t/matrix-algebra/14305/1 "2019-07-02T07:57:02Z")

</div>

I am trying to do matrix rearragement in mathematica, with  
Assumptions = DLL [Element] Matrices[{3, 3}];  
$Assumptions = DLR [Element] Matrices[{3, 3}];  
$Assumptions = DLT [Element] Matrices[{3, 3}];  
$Assumptions = DLB [Element] Matrices[{3, 3}];  
$Assumptions = DRL [Element] Matrices[{3, 3}];  
$Assumptions = DRR [Element] Matrices[{3, 3}];  
$Assumptions = DRT [Element] Matrices[{3, 3}];  
$Assumptions = DRB [Element] Matrices[{3, 3}];  
$Assumptions = DTL [Element] Matrices[{3, 3}];  
$Assumptions = DTR [Element] Matrices[{3, 3}];  
$Assumptions = DTT [Element] Matrices[{3, 3}];  
$Assumptions = DTB [Element] Matrices[{3, 3}];  
$Assumptions = DBL [Element] Matrices[{3, 3}];  
$Assumptions = DBR [Element] Matrices[{3, 3}];  
$Assumptions = DBT [Element] Matrices[{3, 3}];  
$Assumptions = DBB [Element] Matrices[{3, 3}];  
$Assumptions = QL [Element] Matrices[{3, 1}];  
$Assumptions = QR [Element] Matrices[{3, 1}];  
$Assumptions = QT [Element] Matrices[{3, 1}];  
$Assumptions = QB [Element] Matrices[{3, 1}];

eq[1] = DLL QL + DLR QR + DLT QT + DLB QB;  
eq[2] = DRL QL + DRR QR + DRT QT + DRB QB;  
eq[3] = DTL QL + DTR QR + DTT QT + DTB QB;  
eq[4] = DBL QL + DBR QR + DBT QT + DBB QB;  
QR = [Lambda]1 QL; QB = [Lambda]2 QT;  
QR = [Lambda]1 QL; QB = [Lambda]2 QT;  
FT = DTL QL + DTR QR + DTT QT + DTB QB  
eq[6] = DBL QL + DBR QR + DBT QT + DBB QB + [Lambda]2 FT  
eq[7] = Collect[eq[6], QL]  
QT = E1 (DBL + DBR [Lambda]1 + DTL [Lambda]2 +  
DTR [Lambda]1 [Lambda]2) QL (_-Inverse[(DBT +DBB [Lambda]2+DTT [Lambda]2+DTB [Lambda]2^2)]_)  
eq[8] = DRL QL + DRR QR + DRT QT + DRB QB + [Lambda]1 FL  
[Lambda]2 = 1; QL = 1  
eq[9] = Collect[eq[8], [Lambda]1]

The answer I am getting is  
DRL + DBL DRB E1 + DBL DRT E1 + DRB DTL E1 +  
DRT DTL E1 + (DLL + DRR + DBL DLB E1 + DBL DLT E1 + DBR DRB E1 +  
DBR DRT E1 + DLB DTL E1 + DLT DTL E1 + DRB DTR E1 +  
DRT DTR E1) [Lambda]1 + (DLR + DBR DLB E1 + DBR DLT E1 +  
DLB DTR E1 + DLT DTR E1) [Lambda]1^2

which forms a quadratic eigenvalue problem in \lambda\_1 but the order of multiplication of matrices are not coming correct. Can this be fixed

[Quadraticeigenvlaueproblem.nb](https://community.wolfram.com/uploads/short-url/aln07EYZlsCRT25j633zE7kO7UD.nb) (12 KB)

---

<div class="post-metadata">

**Author:** ![danl](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/danl/32/41267_2.png) [@danl](https://community.wolfram.com/u/danl)\
**Post date:** [July 2, 2019, 2:48pm UTC](https://community.wolfram.com/t/matrix-algebra/14305/2 "2019-07-02T14:48:51Z")

</div>

You appear to be confusing `Dot` (for matrix multiplication and related) with `Times`, and that latter is commutative (hence can reorder). Also redefining `$Assumptions` will not be of much use.

---

<div class="post-metadata">

**Author:** ![rajnitdgp2007](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rajnitdgp2007](https://community.wolfram.com/u/rajnitdgp2007)\
**Post date:** [July 2, 2019, 3:39pm UTC](https://community.wolfram.com/t/matrix-algebra/14305/3 "2019-07-02T15:39:20Z")

</div>

Thank you for the response  
I tried using Dot in QT and QB since later on everything comes as X QL=0 and we get co-eficients from X..  
QR = [Lambda]1 QL ; QB = QT;

FL = DLL QL + DLR QR + DLT.QT + DLB .QB;  
eq[5] = DRL QL + DRR QR + DRT.QT + DRB .QB + [Lambda]1 FL;

[Lambda]2 = 1  
FT = DTL QL + DTR QR + DTT.QT + DTB.QB  
eq[6] = DBL QL + DBR QR + DBT.QT + DBB.QB + [Lambda]2 FT  
eq[7] = Collect[eq[6], QL]  
QT = E1.(DBL + DBR [Lambda]1 + DTL [Lambda]2 +  
DTR [Lambda]1 [Lambda]2)  
eq[8] = DRL QL + DRR QR + DRT.QT + DRB .QB + [Lambda]1 FL  
QL = 1 (QL here i treated as some number since the the equation is X QL=0, where X=eq8]  
eq[10] = Collect[Expand[eq[8]], [Lambda]1]

i am getting the result as  
DRL + DLR [Lambda]1^2 + [Lambda]1 (DLL + DRR +  
DLB.E1.(DBL + DTL + DBR [Lambda]1 + DTR [Lambda]1) +  
DLT.E1.(DBL + DTL + DBR [Lambda]1 + DTR [Lambda]1)) +  
DRB.E1.(DBL + DTL + DBR [Lambda]1 + DTR [Lambda]1) +  
DRT.E1.(DBL + DTL + DBR [Lambda]1 + DTR [Lambda]1).

This result is not expandable. Expand command gives me the same result. So how to get the co-ffiecient after that
