Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I need to get every possible value of k that returns infinite number of solutions or no solution to this system:

k x1 + x2 + x3 == 1
x1 + k x2 + x3 == 1
x1 + x2 + k x3 == 1

How do I tell Mathematica to do it?

share|improve this question
    
mat = {{k , 1, 1}, {1, k, 1}, {1, 1, k}}; b = {1, 1, 1}; LinearSolve[mat, b] gives the solution {1/(2 + k), 1/(2 + k), 1/(2 + k)} , so just plugin the k of interest to get any solution you want. For each k there is another solution. Is this what you mean? –  Nasser Oct 6 '13 at 22:36
    
what i need is the possible values of k so that the matrix returns infinite solutions and the possible values of k so that the matrix returns no solution –  XTN Oct 6 '13 at 22:47
    
Then may be Solve[Det[mat] == 0, k], gives {{k -> -2}, {k -> 1}, {k -> 1}} so any of these values of k will make A singular. No solution. –  Nasser Oct 6 '13 at 22:52
    
This may be homework, for which the instructor expects the student to work it out from the documentation. –  Michael E2 Oct 7 '13 at 1:50
    
@XTN Welcome to mathematica.se. Consider registering your account so that you'll be able to interact better with this site. –  Artes Oct 8 '13 at 12:50
add comment

2 Answers

I'd recommend reading appropriately the result of Reduce (in the following we are treating k as a parameter):

Reduce[{ k x + y + z == 1, x + k y + z == 1, x + y + k z == 1}, {x, y, z}] //
TraditionalForm

enter image description here

Now we can enumerate the following cases :


I) k == 1

There are infinitely many solutions { x, y, z} restricted by this formula z == - x - y + 1. Then the matrix m:

m = {{k, 1, 1}, {1, k, 1}, {1, 1, k}};

satisfies:

    Through @ { MatrixRank, NullSpace}[ m /. k -> 1]
{ 1, {{-1, 0, 1}, {-1, 1, 0}}}

i.e the rank of m is 1 and its null space is two-dimensional and spanned by vectors {-1, 0, 1} and {-1, 1, 0}.


II) k != 1 and k != -2

There is only one solution given by this formula x == 1/(2 + k) && y == x && z == 1 - k x - y. Using the option Backsubstitution -> True in Reduce we get the solutions explicitly: (-1 + k) (2 + k) != 0 && x == 1/(2 + k) && y == 1/(2 + k) && z == 1/(2 + k).

e.g. for k == 2

    Through @ { MatrixRank, NullSpace}[ m /. k -> 2]
 { 3, {}}

When the matrix m is not singular we have zero-dimensional null space and exactly one solution.


III) k == -2

Reduce tell us that there are no solutions. See e.g. Det[m /. k -> -2] or just
Reduce[{-2 x + y + z == 1, x - 2 y + z == 1, x + y - 2 z == 1}, {x, y, z}].

    Through @ { MatrixRank, NullSpace}[ m /. k -> -2]
{ 2, {{1, 1, 1}}}

( see the Kronecker–Capelli theorem called also Rouché–Capelli etc.).

share|improve this answer
add comment

Basically, this is not a Mathematica but a mathematics question. To be specific, a linear algebra question. What you have is a coefficient matrix

A = {{k, 1, 1},{1, k, 1},{1, 1, 1 k}}

and you try to classify the solutions of

$$A (x_1,x_2,x_3)^\top=(1,1,1)^\top.$$

If you really have no idea, then I would go with Artes solution, which can be written more concise in matrix form

Reduce[A.{x, y, z} == {1, 1, 1}, {x, y, z}]

I strongly recommend that you review your lecture notes about linear algebra and then try use your knowledge in Mathematica. To be specific, look at the Eigenvalues of your coefficient matrix

Eigenvalues[A]

(* {-1 + k, -1 + k, 2 + k} *)

Since the determinant is the product of these 3 numbers, you can instantly see that you can make the determinant zero by choosing k=1 or k=-2. You will find of course the same result when you use the determinant directly and calculate its roots

d = Det[A]
(* 2 - 3 k + k^3 *)

Solve[d == 0, k]
(* {{k -> -2}, {k -> 1}, {k -> 1}} *)

To classify your solutions, you can calculate the general solution

LinearSolve[A, {1, 1, 1}]

or you can even use

Solve[A.{x, y, z} == {1, 1, 1}, {x, y, z}]

and observe what happens if you insert the values for k which make the system singular.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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