# Solving system of non-linear equations with 2 unknowns.

I have these system of equations that I'm solving for a 3DoF robotic joint. I've come to the pinnacle of the problem and I'm kinda stuck.

Here $$P_x$$, $$P_y$$, $$P_z$$ and $$a_1$$, $$a_2$$, $$a_3$$ are known constants and $$\theta_1$$, $$\theta_2$$ and $$\theta_3$$ are unknowns to be found.

$$\begin{bmatrix}cos(\theta_1).P_x + P_y.sin(\theta_1)\\cos(\theta_1).P_y - P_x.sin(\theta_1)\\P_z \end{bmatrix}$$ = $$\begin{bmatrix} a_1 + a_2.cos(\theta_2)+a_3(cos(\theta_2).cos(\theta_3) - sin(\theta_2.sin(\theta_3)) \\0 \\a_2.sin(\theta_2) + a_3(cos(\theta_2).sin(\theta_3) + cos(\theta_3).sin(\theta_2))\end{bmatrix}$$

Here taking equation 2 from the left matrix we get $$\theta_1$$ like this.

$$\frac{sin(\theta_1)}{cos(\theta_1)} = \frac{P_y}{P_x}$$ $$tan\theta_1 = \frac{P_y}{P_x}$$ $$\theta_1 = arctan(\frac{P_y}{P_x})$$

thus giving us a system of 2 nonlinear equations with 2 unknowns.

$$[ cos(\theta_1).P_x + P_y.sin(\theta_1)] = [a_1 + a_2.cos(\theta_2) + a_3(cos(\theta_2).cos(\theta_3)-sin(\theta_2).sin(\theta_3))$$ $$[P_z] = [a_2.sin(\theta_2) + a_3(cos(\theta_2).sin(\theta_3) + cos(\theta_3).sin(\theta_2))]$$

How do I go about solving this? ( I have gone further solving these equations but got to no where ) could anyone please guide me on this?

• \sin, \cos, \tan, etc. – Rodrigo de Azevedo Nov 27 '19 at 18:55
• @moo could you please be a bit more elaborate? – Prathik Gurudatt Nov 27 '19 at 20:18
• @moo maybe add an example with the current equations? – Prathik Gurudatt Nov 27 '19 at 22:02
• @moo in the second line i have defined the known constants. In bold. – Prathik Gurudatt Nov 28 '19 at 9:47
• @moo: "try numerical methods to see" is cheap advice, you could say that for any question. Better to look at the problem first. – Yves Daoust Nov 28 '19 at 10:06

Rewrite the system as

$$\begin{cases}a_3\cos(\theta_2+\theta_3)=P_*-a_2\cos\theta_2,\\ a_3\sin(\theta_2+\theta_3)=P_z-a_2\sin\theta_2\end{cases}$$

$$a_3^2=P_*^2+P_z^2-2P_*a_2\cos\theta_2-2a_2P_z\sin\theta_2+a_2^2.$$
Knowing $$\theta_2$$, you easily get $$\tan(\theta_2+\theta_3)$$.