# I found the matrices but can't find the inverse kinematics angles

I need to find inverse and forward kinematics of Mitsubishi RV-M2 as a homewrok. I found the forward kinematics part. But I got stuck in inverse kinematics.

Teacher said we can think that wrist joints is not moving.(To make equations easier I guess.) This is why I thought tetha4(in T4) and tetha5(in T5) should be 0.

Here is my MATLABcode

syms t1 t2 t3 d1 a1 a2 a3 d5 px py pz r1 r2 r3 r4 r5 r6 r7 r8 r9 % sybolic equations

T1=[cos(t1)     -sin(t1)        0       0;
sin(t1)     cos(t1)         0       0;
0            0              1       d1;
0            0              0       1;];

T2=[cos(t2)     -sin(t2)        0       a1;
0            0              -1      0;
sin(t2)     cos(t2)         0       0;
0            0              0       1;];

T3=[cos(t3)     -sin(t3)        0       a2;
sin(t3)     cos(t3)         0       0;
0             0             1       0;
0             0             0       1;];

T4= [0           -1             0       a3;
1             0             0       0;
0             0             1       0;
0             0             0       1;];

T5=[1             0             0       0;
0             0            -1      -d5;
0             1             0       0;
0             0             0       1;];

Tg= [r1 r2 r3 px;
r4 r5 r6 py;
r7 r8 r9 pz;
0 0 0 1;];

left= inv(T1)* Tg;
left=left(1:4,4);
left=simplify(left)
right= T2*T3*T4*T5;
right=right(1:4,4);
right=simplify(right)


This gives us

I find t1 using this and results are matching with forward kinematics equations. But I couldn't find t2 and t3. How can I do that? Is there a formula or somethig?

I don't want to just give the answer....try squaring the $x$ and $z$ terms (after moving $a_1$ to the left) and see where that gets you.