# How to solve two non-linear equation having sine terms

1 view (last 30 days)
I have two equations, i want to find the solution of the two equations cosx-cosy = 0.2 and cos5x-cos5y = 0.1. How can i solve this using matlab. I have tried of using the solve command, but the result showing is empty. Can you know how to find the solution for this two equations.
Roger Stafford on 8 May 2013
I suggest you use the trigonometric identity which expresses cos(5*A) in terms of cos(A).

Roger Stafford on 8 May 2013
It is not hard to express cos(11*A) and cos(13*A) in terms of cos(A). Their expressions will have just six and seven terms, respectively, in accordance with the formulas below. The main difficulty comes when one makes the substitution of cos(x)-0.2 (or whatever it is) in place of cos(y) in these expressions to get a single equation entirely in terms of cos(x). For that one can make good use of the symbolic toolbox to do the substitutions and collect like powers of cos(x). This finally results in a polynomial equation in powers of cos(x) which can be solved numerically using matlab's 'roots' function followed by 'acos'. In the case of cos(13*x) and cos(13*y) you will get a 12-th order equation which can have anything from no roots up to twelve valid roots.
I assume you realize that besides this multiplicity of roots, any values of x and y can be changed in sign or have any multiple of 2*pi added or subtracted, so there will actually be infinitely many possible. This is inherent in the problem.
Here are the formulas for cos(n*A):
cos(5*A) = 16*cos(A)^5 - 20*cos(A)^3 + 5*cos(A)
cos(6*A) = 32*cos(A)^6 - 48*cos(A)^4 + 18*cos(A)^2 - 1
cos(7*A) = 64*cos(A)^7 - 112*cos(A)^5 + 56*cos(A)^3 - 7*cos(A)
...
cos(n*A) = 2^(n-1)*cos(A)^n
- n/1!*2^(n-3)*cos(A)^(n-2)
+ n*(n-3)/2!*2^(n-5)*cos(A)^(n-4)
- n*(n-4)*(n-5)/3!*2^(n-7)*cos(A)^(n-6)
+ n*(n-5)*(n-6)*(n-7)/4!*2^(n-9)*cos(A)^(n-8) .....

I have further equations in terms of cos(11*A) and cos(13*A), which is very hard to define interms of the cosA. I need the solution format interms of cos(5*A) so that i can apply to futher equations.

### Categories

Find more on Pattern Recognition and Classification in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!