How to obtain all the solutions of quadratic equations with multiple variables?

6 views (last 30 days)
I am trying to solve quadratic equations with multiple variables. For example, I want to solve
a^2+b^2 = 1.25;
c^2+d^2 = 0.58;
a*c+b*d = 0.55;
a*d-b*c = 0.65;
The code I wrote is as follows.
>> syms a b c d
>> eqns = [a^2+b^2 == 1.25, c^2+d^2 == 0.58, a*c+b*d == 0.55, a*d-b*c == 0.65];
[sola,solb,solc,sold] = solve(eqns,[a b c d])
sola =
-(11*2^(1/2)*29^(1/2))/116
(11*2^(1/2)*29^(1/2))/116
solb =
(13*2^(1/2)*29^(1/2))/116
-(13*2^(1/2)*29^(1/2))/116
solc =
-(2^(1/2)*29^(1/2))/10
(2^(1/2)*29^(1/2))/10
sold =
0
0
Matlab provides two sets of solutions, but they are not all the sets of solutions. At least [1, -0.5, 0.7, 0.3] is another set of solution. Why Matlab doesn't provide all the solutions when using 'solve' function? How to obtain all the solution?
Can anyone help? Thanks in advance.

Accepted Answer

Bruno Luong
Bruno Luong on 17 Oct 2018
Edited: Bruno Luong on 17 Oct 2018
I have impression the 4 equations are not independent, and that might confuse MATLAB.
For any 2x2 rotation matrix
R = [cos(theta), -sin(theta);
sin(theta) cos(theta)}
I believe if (a,b,c,d) a solution, if I define
abp = R*[a;b];
cdp = R*[c;d];
then
(abp(1),abp(2),cdp(1),cdp(2))
is another solution for any theta not a multiple of 2*pi.
So actually there are an infinity of solutions. Of course MATLAB won't be able to list them. But pretending cardinal of all solutions is 2 is obviously very wrong.
And can also prove that any solution is rotated (as described above) from another.
  4 Comments
Huanyu Zuo
Huanyu Zuo on 18 Oct 2018
Edited: Huanyu Zuo on 18 Oct 2018
I accepted your answer, though you did not tell me how to obtain all the solutions using Matlab. The way you think is very impressive and you provide me a method to deal with similar questions. Thank you!
Bruno Luong
Bruno Luong on 18 Oct 2018
As I don't own SYMBOLIC TBx I can't help you to deal with MATLAB, but at least with some though. Thanks, glad to help.

Sign in to comment.

More Answers (1)

madhan ravi
madhan ravi on 17 Oct 2018
As you can see you got all the solutions , each variable has two solutions. So I don’t see anything wrong in it.
  15 Comments
Huanyu Zuo
Huanyu Zuo on 17 Oct 2018
Yeah, just as Bruno said. For example,
>> b=0;
>> syms a c d
>> eqns=[a^2+b^2==1.25,c^2+d^2==0.58,a*c+b*d==0.55,a*d-b*c==0.65];
>> [sola,solc,sold]=solve(eqns,[a c d])
sola =
-5^(1/2)/2
5^(1/2)/2
solc =
-(11*5^(1/2))/50
(11*5^(1/2))/50
sold =
-(13*5^(1/2))/50
(13*5^(1/2))/50
They are the new sets of solutions.

Sign in to comment.

Products


Release

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!