15

How to solve the following matrix equation?

Solve[MatrixRank[{{1, x, 3},
                  {2, 4, 5},
                  {2, 4, x}}] == 2, x, Reals]
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

6 Answers6

19
mat = ({{1, x, 3}, {2, 4, 5}, {2, 4, x}});
Select[MatrixRank[mat /. #] == 2 &][Solve[Det[mat] == 0, x, Reals]]

{{x -> 2}, {x -> 5}}

kglr
  • 394,356
  • 18
  • 477
  • 896
14

Solutions force exactly one eigenvalue to be zero. So we solve for the condition that an eigenvalue vanish, and check that rank is two.

mat = {{1, x, 3}, {2, 4, 5}, {2, 4, x}};
candidateSols = Flatten[Map[Solve[# == 0, x] &, Eigenvalues[(mat)]]]

(* Out[997]= {x -> 2, x -> 5} *)

Both pass the test:

Map[MatrixRank[mat /. #] &, candidateSols]

(* Out[995]= {2, 2} *)
Daniel Lichtblau
  • 58,970
  • 2
  • 101
  • 199
9

A not so good answer

Cases[Table[{x, MatrixRank[({{1, x, 3}, {2, 4, 5}, {2, 4, x}})]}, {x, -10, 10, 1/10}], {_, 2}]

gives out

{{2, 2}, {5, 2}}

So the answer is 2 or 5.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
AsukaMinato
  • 9,758
  • 1
  • 14
  • 40
5

Here is an indirect route, which has the advantage of postponing operations like MatrixRank[] until the end.

Consider the identity

$$\begin{pmatrix}1&x&3\\2&4&5\\2&4&x\end{pmatrix}=\begin{pmatrix}1&0&3\\2&4&5\\2&4&0\end{pmatrix}+\begin{pmatrix}x&0\\0&0\\0&x\end{pmatrix}\begin{pmatrix}0&1&0\\0&0&1\end{pmatrix}$$

A condition for this matrix to be invertible (cf. the Sherman-Morrison-Woodbury formula) is that the capacitance matrix

$$\begin{pmatrix}1&0\\0&1\end{pmatrix}+\begin{pmatrix}0&1&0\\0&0&1\end{pmatrix}\begin{pmatrix}1&0&3\\2&4&5\\2&4&0\end{pmatrix}^{(-1)}\begin{pmatrix}x&0\\0&0\\0&x\end{pmatrix}=\begin{pmatrix}1-\frac{x}{2}&-\frac{x}{20}\\0&1-\frac{x}{5}\end{pmatrix}$$

be nonsingular.

Thus,

Solve[Det[IdentityMatrix[2] +
          {{0, 1, 0}, {0, 0, 1}}.LinearSolve[{{1, 0, 3}, {2, 4, 5}, {2, 4, 0}},
                                             {{x, 0}, {0, 0}, {0, x}}]] == 0, x]
   {{x -> 2}, {x -> 5}}

Check:

MatrixRank /@ ({{1, x, 3}, {2, 4, 5}, {2, 4, x}} /. %)
   {2, 2}
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
2

I have made a MatrixRankSym feature with symbolic computation here. And we can use for this question directly:

Solve[MatrixRankSym[{{1, x, 3}, {2, 4, 5}, {2, 4, x}}] == 2, x, Reals]

{{x -> 2}, {x -> 5}}

yode
  • 26,686
  • 4
  • 62
  • 167
0

You get rank == 2, if one row is the linear combination of the two others.

mat= {{1, x, 3}, {2, 4, 5}, {2, 4, x}};

Solve[aa mat[[1]] + bb mat[[2]] == mat[[3]], {x, aa, bb}, Reals]

(* {{x -> 2, aa -> -6, bb -> 4}, {x -> 5, aa -> 0, bb -> 1}} *)

Akku14
  • 17,287
  • 14
  • 32