3
$\begingroup$

I am relatively new to Mathematica. Suppose I have a matrix

M = {{a^2, a b, 0}, {a b, b^2, 0}, {0, 0, 0}}

How can I get Mathematica to decompose this into an outer product of the vector

v = {a,b,0}

with itself? I assume it has something to do with the function TensorReduce but I am not sure. In general if I know that a tensor T can be written in the form $T = A \otimes B$ and I know T and B how can I use mathematica to find A?

Related:

Symbolic tensor simplifications and the identity matrix

How do I simplify a vector expression?

Simplify vector expression - is there something like "Factor" for vectors, dot products etc.?

Thank you!

Update: I think the function CoefficientArray may be useful here but I can't quite figure it out fully.

$\endgroup$
5
  • $\begingroup$ With[{z = Array[x, Length@M]}, z /. Solve[M == TensorProduct[z, z], z]]? $\endgroup$
    – kglr
    Commented Nov 20, 2018 at 16:59
  • $\begingroup$ This works wonderfully! Now if I were to define M = {{a c, a d, 0}, {b c, b d, 0}, {0, 0, 0}} and I knew the form of z how could I use your answer to solve for y = {c,d,0}? $\endgroup$
    – Takoda
    Commented Nov 21, 2018 at 11:43
  • 1
    $\begingroup$ Takado, does With[{y = Array[x, Length@M]}, y /. Solve[M == TensorProduct[z, y], y]] work? $\endgroup$
    – kglr
    Commented Nov 27, 2018 at 1:58
  • $\begingroup$ Yes that exactly what I was looking for thank you :) $\endgroup$
    – Takoda
    Commented Nov 27, 2018 at 16:13
  • $\begingroup$ Takoda, I posted the comment as an answer. $\endgroup$
    – kglr
    Commented Nov 27, 2018 at 16:18

1 Answer 1

2
$\begingroup$
With[{z = Array[x, Length@M]}, z /. Solve[M == TensorProduct[z, z], z]]

{{-a, -b, 0}, {a, b, 0}}

Update: if I were to define M = {{a c, a d, 0}, {b c, b d, 0}, {0, 0, 0}} and I knew the form of z how could I .. solve for y = {c,d,0}?

M2 = {{a c, a d, 0}, {b c, b d, 0}, {0, 0, 0}};
z = {a, b, 0};
With[{y = Array[x, Length@M2]}, y /. Solve[M2 == TensorProduct[z, y], y]]

{{c, d, 0}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.