Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Linear System in Mathematica -- Solve returns only the zero vector
(though there are more solutions)

Replies: 3   Last Post: May 17, 2013 3:57 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Roland Franzius Posts: 586 Registered: 12/7/04
Re: Linear System in Mathematica -- Solve returns only the zero vector
(though there are more solutions)

Posted: May 17, 2013 2:38 AM
 Plain Text Reply

Am 16.05.2013 11:46, schrieb Dino:
> Hey guys,
> say I want to find the null space of this matrix (which I define as 'Tbl'):
> {{c, 1/2, 0}, {0, 1 + c, 1}, {0, 1/2, 3 + c}}
>
> I try this:
> Solve[Tbl.{x, y, z} == {0, 0, 0}, {x, y, z}]
> and I get this:
> {{x -> 0, y -> 0, z -> 0}}
>
> But the zero vector is not the only solution. For example if I do this:
> c = Sqrt[3/2] - 2
> then
> Solve[Tbl.{x, y, z} == {0, 0, 0}, {x, y, z}]
> returns
> {{x -> -(((-2 - Sqrt[6]) z)/(-4 + Sqrt[6])), y -> -(2 + Sqrt[6]) z}}
> which is closer to what I want. I actually want something like that with 'c' in it. (And then I have some other equation that I'll use to find the value of c. Btw, the matrix above is only an example. I actually care to find a solution to a whole range of matrices of larger and larger sizes.)
>
> Can anyone help? I guess I want to tell Mathematica somehow that c is some arbitrary constant and there may be more solutions, depending on the value of c.
>

Use Reduce or Solve for c in Eigenvalues.

mat = {{c, 1/2, 0}, {0, 1 + c, 1}, {0, 1/2, 3 + c}};
expr = mat . {x, y, z}
{c*x + y/2, (1 + c)*y + z, y/2 + (3 + c)*z}

(*Use Reduce to generate a logical Or-list of And-equations *)

rd = Reduce[(0 == #1 & ) /@ expr]
(z == 0 && y == 0 && x == 0) || (z == 0 && y == 0 && x != 0 &&
c == 0) ||
((y == -2*z - Sqrt[6]*z || y == -2*z + Sqrt[6]*z) && y != 0 &&
x == (-13*y*z + 6*z^2)/(5*y) && x != 0 && c == -(y/(2*x)))

(*Mapping an Assumption for Simplify into the Or-List*)

(Assuming[#1, FullSimplify[expr]] & ) /@ rd
{0, 0, 0} || {0, 0, 0} || {0, y + c*y + z, y/2 + (3 + c)*z}

(* for linear vector equations eliminate some vector components*)

el = Eliminate[(0 == #1 & ) /@ expr, {z, y}]
c*(5 + 8*c + 2*c^2)*x == 0

(*and solve for the matrix parameter c *)

sol = Solve[el, c]
{{c -> 0}, {c -> (1/2)*(-4 - Sqrt[6])}, {c -> (1/2)*(-4 + Sqrt[6])}}

(* replace c in expression and Solve for y,z as function of x*)

(Solve[((0 == #1 & ) /@ (expr /. sol))[[#1]], {y, z}] & ) /@ Range[3]
{{{y -> 0, z -> 0}}, {{y -> 4*x + Sqrt[6]*x,
z -> (1/2)*(2 + Sqrt[6])*(4*x + Sqrt[6]*x)}},
{{y -> 4*x - Sqrt[6]*x,
z -> (1/2)*(-2 + Sqrt[6])*(-4*x + Sqrt[6]*x)}}}

(* Easiest method: get the eigensystem of mat*)

eg = Eigensystem[mat]

{{c, (1/2)*(4 - Sqrt[6] + 2*c), (1/2)*(4 + Sqrt[6] + 2*c)},
{{1, 0, 0},
{-((-2 - Sqrt[6])/(-4 + Sqrt[6])), -2 - Sqrt[6], 1},
{-((2 - Sqrt[6])/(4 + Sqrt[6])), -2 + Sqrt[6], 1}}}

(*Solve eigenvalue list for zero eigenvalues in parameter c*)

(Solve[eg[[1, #1]] == 0, c] & ) /@ Range[3]
{{{c -> 0}}, {{c -> (1/2)*(-4 + Sqrt[6])}}, {{c -> (1/2)*(-4 -
Sqrt[6])}}}

Hope it helps

--

Roland Franzius

Date Subject Author
5/16/13 Dino
5/16/13 RGVickson@shaw.ca
5/17/13 Roland Franzius
5/17/13 Dino

© The Math Forum at NCTM 1994-2018. All Rights Reserved.