1

This is my first post here so I'm not really sure how all of this works, but I'll try my best to explain my problem. I'm supposed to solve the equation system

ax + y + az = 2
x + ay + z = 2
x + az = 1

and then answer "for which values on a does the equation system only have one solution? For which values on a do we have an infinite amount of solutions, and what value on a lacks solutions."

I understand that I'm supposed to use solve, but I'm not exactly sure how. My current code is

Solve[{a*x + y + a*z == 2, x + a*y + z == 2, x + a*z == 1}, x, y, z]

But it just throws an error with z, so I understand that the condition at the end must be changed, but I don't know to what.

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
Griezy
  • 11
  • 2
  • 2
    You are almost there. the second argument of Solve must be a list. That is, {x,y,z}, rather than x,y,z.This will give you the solution. I propose that you take a look at the documentation. To answer about the infinite number of solutions check Menu/WolframDocumentation/Det and apply the corresponding theorem. – Alexei Boulbitch Nov 03 '18 at 16:21

2 Answers2

1

Try this:

Solve[{a*x + y + a*z == 2, x + a*y + z == 2, x + a*z == 1}, {x, y, z}]

The solution is:

(* {{x -> -(1/(-1 - a)), y -> 2/(1 + a), z -> 1/(1 + a)}} *)
Tugrul Temel
  • 6,193
  • 3
  • 12
  • 32
  • 1
    Ah, I forgot the curly brackets around the second arguments, just as you and Alexei above pointed out! Regarding "the for which values on a does the equation system only have on solution? For which values on a doe we have an infinite amount of solutions, and what value on a lacks solutions" part, how should I do this? – Griezy Nov 03 '18 at 16:30
  • @Griezy: Since you have a linear system of three equations, you should just analyze the coefficient matrix, C={{a,1,a},{1,a,1},{1,0,a}} in your example. For real solution, a should not be equal to 1 nor -1, in which case you will end up with indeterminacy. for all other values of coefficients there is a real solution. – Tugrul Temel Nov 03 '18 at 16:39
  • So as long as a is not equal to 1 or -1, there's an infinate amount of solutions? For which values does a only have one solution then? And for what value of do we not have any solutions? – Griezy Nov 03 '18 at 16:52
  • @Griezy: Yes, you right. For your second question, If I understand you correctly, you want a solution for a. If this is the case, you should just solve the solution for a in terms of x,y,z. (1+a)=(-1/x)=(2/y)=(1/z). But I do not know what you want to achieve with this exercise. If you tell your goal then it can be answered. – Tugrul Temel Nov 03 '18 at 17:02
  • My goal is to after solving the equation system: solve for which values on a has the equation system only have on solution? For which values on a do we have an infinite amount of solutions(solved), and what value on a lacks solutions – Griezy Nov 03 '18 at 17:06
  • @Griezy: You might be confused with the term solution. The solution to your system is a triple (x,y,z) in terms of a. For any values of a, except -1 and 1 you have a solution for (x,y,z). However, if you want a solution for a in terms of (x,y,z) then you should solve the system of equations for a in which case every equation can be solve for a, which will be different from each other. Best way may be to use ContourPlot for each one of the equations and see at which points all three equations intersect. This will also generate the same solution given earlier. – Tugrul Temel Nov 03 '18 at 17:20
  • So if I were to answer the question I posted I'd say: If a is -1, or 1, there is no solutions. Otherwise there's an infinite amount of solutions. Is that right? What about the "only have on solution"? – Griezy Nov 03 '18 at 17:23
  • @Griezy: Do you mean "only have ONE solution"? It is difficult for me to understand your question. One solution, for example, is: If a=3, the solution for (x,y,z)=(-1/4, 1/2, 1/4). Is this what you mean? I reiterate that "only" one solution is not correct to say. – Tugrul Temel Nov 03 '18 at 17:36
  • Yes, that's what I mean. The entire question is: For which values of a is there only one solution. – Griezy Nov 03 '18 at 17:40
  • @Griezy: The answer is: for each real number a, except -1 and 1, there is a solution for (x,y,z). if a=5 there is a solution, if a=7 again there is a different solution, etc. I hope this answers your question. – Tugrul Temel Nov 03 '18 at 17:55
1

I think you will find utility in Reduce.

eqs = {a*x + y + a*z == 2, x + a*y + z == 2, x + a*z == 1};

Reduce[eqs, {x, y, z}, Backsubstitution -> True]
(a == 1 && y == 1 && z == 1 - x) ||
 ((-1 + a) (1 + a) != 0 && x == 1/(1 + a) && y == 2/(1 + a) && z == 1/(1 + a))

Using Reduce again for further information on the condition of the second solution:

Reduce[(-1 + a) (1 + a) == 0]    (* note != changed to == *)
a == -1 || a == 1

This gives no solution for $a = -1$. ($a = 1$ has a separate solution listed first.)

Checking it:

Reduce[eqs /. a -> -1]
False

Merely looking at the form of the second solution with (1 + a) as the denominator of each x,y,z should lead us to consider the case of $a = 0$:

Reduce[eqs /. a -> 0]
y == 2 && z == 1 && x == 1
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371