# Simultaneous equations—classify the solution set as finite, infinite, or none [duplicate]

How do I find the values of $b$ and $c$ for the equations $x + 5 y = 4$ and $2 x + by = c$ with a unique solution, an infinite set of solutions and no solutions with Mathematica?

• @JasonB I have tried using the 'solve' and 'piecewise' functions, but the inputs end up being long/convoluted... I was curious as to whether there was an easier option. (I am new to mathematica, so I am sorry if this question is silly!)
– Gael
Jan 27 '16 at 8:35
• Not really sure about this one. By inspection, it's clear that setting {b,c} to {10,8} is a solution, but I can't figure out how to get Mathematica to spit this answer out. Jan 27 '16 at 8:57
• Reduce[{x + 5 y == 4, 2 x + b y == c}, {b, c}] gives something, but not what I was looking for. Jan 27 '16 at 8:58
• @JasonB Thank you for the help!
– Gael
Jan 27 '16 at 10:00
• Possible duplicate of Classification of a linear system of equations with a parameter. Closely related General form of a linear transformation Jan 27 '16 at 10:18

## 2 Answers

The quickest way to get there is to first Solve the first equation for x or y, then use Reduce on the second equation for the other variable:

Reduce[
2*x + b*y == c /. Solve[x + 5*y == 4, y],
x]


So either b=10, which makes c=8, or else c and b depend on the value of x.

It's interesting the different outputs you get depending on which variables you reduce by (thanks to Eric Towers for the tip on Backsubstitution)

DeleteDuplicates[
LogicalExpand@
Reduce[{x + 5 y == 4, 2 x + b y == c}, #,
Backsubstitution -> True] & /@ Permutations[{b, c, x, y}]
]


It's clear from these that b=10 and c=8 are the only solutions that are valid for all x and y. Is there a way to specify that you want the solution in this case?

• Thank you for all your help, Jason! :) Your effort is very much appreciated.
– Gael
Jan 27 '16 at 10:23
• "BackSubstitution -> True" will make it clearer that "y == (4 - x)/5)" in the second disjunction of your first Reduce[] is actually "y == (-8 + c)/(-10 + b)". Jan 27 '16 at 14:01

I think this is somehow a problem from the perspective that Mathematica will NOT teach you math, it will help you computing stuff in several cases. You have to be able to interpret the output with your math understanding.

Your equations can be solved by

eqs = {
x + 5*y == 4
, 2*x + b*y == c
};
vars = {x, y};
sol = Solve[eqs, vars]


Here Mathematica gave you the answer assuming that -10 + b will not be zero, although we never gave that information.

From your math class you should know how to differentiate between the cases. So if you solve first, e.g., in the first equation for x

solx = Solve[eqs[[1]], x][[1]]


and put this in the second equation

eqs[[2]] /. solx[[1]] // FullSimplify


you can clearly see, that if b equals 10 and c equals 8, then y can be anything, so you get an infinite number of solutions. But if b equals 10 and c is not specified or something like c==3, then this equations can not be fulfilled in general, so you dont get any solution (you can identify this cases in the solution given above in sol but Mathematica will not tell you that). You can check this as follows

Solve[eqs /. {b -> 10}, vars]
Solve[eqs /. {c -> 8, b -> 10}, vars]


Alternatively you can use

Reduce[eqs, vars]


but you have to be able to interpret this output by yourself, i.e., for the first case you get an infinite number of solutions for x and y (since they depend on each other) and for the second case you a specific x and then a specific y. If none of these cases are fulfilled, e.g., b==10 and c==3, then you dont have a solution.

My point is that Mathematica will NOT teach you math, in several cases you have to be able to interpret the output and know that may be Mathematica itself made some assumptions on its own (see the output of sol).

• Thank you - To clarify, I can do the question by hand. I was more curious as to whether there was an option to obtain and present the answer on mathematica.
– Gael
Jan 27 '16 at 9:55
• Hmmm .... the best thing you will get from Mathematica is for this case with Reduce, as already pointed out by Jason B, since it gives you the cases under which you get solutions. But an interpretation by the user is still necessary. Jan 27 '16 at 10:02
• I see - Thank you for the help! Very much appreciated.
– Gael
Jan 27 '16 at 10:07