# Couldn't understand the following portion in exercise U1-3

Hi,
I couldn’t understand the following portion of solution code for exercise U1-3. Could somebody please explain the logic in trigonometric calculations? Any url for understanding the theory would also be a great help!

Thanks!
Best,

1 Like

Very good question!
It should maybe be stated the reason its calculated like that in the notebooks, but noone had asked about it before

Essentially we are using the Euclidian distance between two points on the unit circle and Law_of_cosines. We based the python solution in this answer in StackOverflow.
We do this to verify that the angle where the robot head is now is the one we want.

For sure we could do this in many ways, but this is the way we decided to use to verify that the angles were similar.

Hope this clears up the doubts. Don’t hesitate to ask further questions if needed.

HI Miguel,
I read the theory you mentioned and understood the logic except for one thing. Why are we using squared euclidean distance for unit circle? Why don’t we consider the magnitude of vector created by points with the origin of the frame that we are working in?

PS: I want to thank the entire Robot Ignite Academy team for providing such interesting and educating courses!