1
$\begingroup$

I have this matrix equation $$ \left( \begin{array}{ccc} a & b & 0 \\ c & d & e \\ 0 & f & g \\ \end{array} \right)\left( \begin{array}{c} x \\ y \\ z \\ \end{array} \right)=0 $$ where all the parameters $\{a,b,c,d,e,f,g\}$ are nonzero; I am looking for a nontrivial solution for $\{x,y,z\}$ i.e. when the determinant of the coefficient matrix is zero. How can I ask this from Mathematica? Normally, without any assumptions, it just gives the trivial solution zero.

system = { a x + b y == 0  ,  c x + d y + e z == 0 , f y + g z == 0};
Solve[system, {x, y, z}]
(* {{x -> 0, y -> 0, z -> 0}} *)

P.S. NullSpace also gives the empty answer.

$\endgroup$
1
  • 1
    $\begingroup$ Just knowing det=0 is not enough to get the general solution, because this depends on the rank of the coefficient matrix. $\endgroup$
    – A. Kato
    Commented Jul 14 at 1:49

2 Answers 2

5
$\begingroup$

The answer will depend how the determinant vanishes:

mat = {{a, b, 0}, {c, d, e}, {0, f, g}};
Det[mat]

(* -a e f - b c g + a d g *) 

cases = Solve[% == 0]

enter image description here

Grid[{#, NullSpace[mat /. #]} & /@ cases, Dividers -> All]

enter image description here

Remark: All the solutions above corresponds to generic cases, i.e. the matrix is assumed to be of rank two.

$\endgroup$
4
  • $\begingroup$ Thank you very much. So, since all the parameters are non-zero, only the first case in your list can be a nontrivial solution here. $\endgroup$
    – charmin
    Commented Jul 14 at 2:18
  • 1
    $\begingroup$ Your welcome. You are right. I overlooked the non-zero condition. $\endgroup$
    – A. Kato
    Commented Jul 14 at 2:22
  • $\begingroup$ May I ask you to please explain where the matrix rank plays a role in your code? $\endgroup$
    – charmin
    Commented Jul 14 at 12:51
  • 1
    $\begingroup$ @charmin, I'm sorry if I misled you. In this code, the rank does not play any role. Also, with your positivity assumption, mat is guaranteed to have rank two. I just pointed out: Solve and NullSpace treat all parameters, which are not explicitly specialized, as generic values. The generic 3x3 matrix with det=0 has rank two, so the solution space is always one dimensional. But, if you need to care about more special cases, say a=b=f=g=0, then rank of mat becomes one, and the solution space is now two dimensional spanned by {-e/c,0,1} and {-d/c,1,0}. $\endgroup$
    – A. Kato
    Commented Jul 15 at 1:29
4
$\begingroup$

Try Reduce

solu = Reduce[{{a, b, 0}, {c, d, e}, {0, f, g}} . {x, y, z} - {0, 0,0} == 0 , {x, y, z}, Backsubstitution -> True];
Simplify[solu, Map[# != 0 &, {a, b, c, d, e, f, g }]]

(*(e f != d g && y == (c g x)/(e f - d g) && z == (c f x)/(-e f + d g)&&a == (b c g)/(-e f + d g)) 
|| (a e f + b c g != a d g && x == 0 &&y == 0 && z == 0) *)
$\endgroup$
1
  • $\begingroup$ Thank you very much! simple and elegant! $\endgroup$
    – charmin
    Commented Jul 14 at 13:10

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.