function Q=invkinRR(x,y,L1,L2)
theta2=acos((x^2+y^2-L1^2-L2^2)/(2*L1*L2));
q2A=theta2;
theta1=atan2((y*(L1+L2*cos(theta2)))-(x*L2*sin(theta2)),(x*(L1+L2*cos(theta2))+(y*L2*sin(theta2))));
q1A=theta1;

theta2=-acos((x^2+y^2-L1^2-L2^2)/(2*L1*L2));
q2B=theta2;
theta1=atan2((y*(L1+L2*cos(theta2)))-(x*L2*sin(theta2)),(x*(L1+L2*cos(theta2))+(y*L2*sin(theta2))));
q1B=theta1;

Q=[q1A q1B; q2A q2B];
end
