I do not understand why I get imaginary numbers as answers to this simultaneous equation I am trying to solve

3 views (last 30 days)
syms x y
eqn1 = 87*sind(x)+ 65*sind(y) == (-92*sind(200))-(73*sind(0))
eqn2 = 87*cosd(x) + 65*cosd(y) == (92*cosd(200)) - (73*cosd(0))
sol = solve(eqn1,eqn2,x,y)
xSol = sol.x
ySol = sol.y
vpa(xSol)
vpa(ySol)

Accepted Answer

William Rose
William Rose on 3 Mar 2021
Edited: William Rose on 3 Mar 2021
When you run the code you provided, eqns 1 and 2 are displayed:
87 sin x + 65 sin y = 31.47 (1)
87 cos x + 65 cos y = -159.45 (2)
Eqn 2 tells you right away that there is no real solution, because cos(x) and cos(y) can never be more negative than -1. So the left hand side of eqn 2 can never be more negative than -152, and so can never equal -159.45, if x and y are real. That's why you get a complex solution.
Idea for alternate solution (summary):
  1. Apply simple algebra to equations 1 and 2 above.
  2. Use the identity cos^2 x = 1-sin^2 x to get an equation that involves sin y only.
  3. Do some more algebra to get a quadratic equation for the variable z=sin y.
  4. Solve for z using the quadratic formula. The solution is z1=..., z2=.... (I haven't done it.)
  5. Solve for y: y = arcsin(z), since z is defined as z=sin y. I predict that the solutions z1 and z2 from step 4 will not be in the range[-1,+1]. If my prediction is right, then there is no real angle y such that sin y=z1 or sin y=z2. So there's no real solution.
  1 Comment
William Rose
William Rose on 3 Mar 2021
I did the alternate solution which I mentioned above, and it worked. You get a quadratic equation for z=sin y, where the constants A,B,C in the quadratic depend on the constants in the original problem statement. The radicand, B^2-4AC, is negative. Therefore z=sin y is complex, so y is also complex. There is no real solution.
Alternate solution:
a sin x + b sin y = c (1)
a cos x + b cos y = d (2)
where a=87, b=65, c=31.47, and d=-159.45
Divide eqn 1 and eqn 2 by a to get
sin x = e - g sin y (3)
cos x = f - g cos y (4)
where e=c/a=.3617, f=d/a=-1.8328, and g=b/a=.7471. Square (3) and square (4) to get:
(5)
(6)
Apply the identity , to LHS of eqn (6), and use RHS of eqn (5) for :
(7)
Note that we have eliminated sin x from the equation. The only unknown in eqn (7) is (and , but ). So we sunstitute z for sin y and we substitute for cos y, in eqn (7), to get
(8)
Do some algebra on eqn (8) to get
(11)
where
(12A)
(12B)
(12C)
Solve for z:
(13)
When you plug in the known values for e,f,g (see above) to eqns (12A,12B, 12C), you find that
A=7.792, B=-3.295, C=1.791, which means that the term under the square root in eqn (13) is negative:
That means z=sin y is complex. Therefore y=arcsin(z) is also complex. There is no real solution.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!