I have been given some math (picture below) with no explanation that will allow me to find the distance from a wall to an autonomous car is that I'm programming. But I am unsure of how the angle $\alpha$ is retrieved using trigonometry. Can someone explain that first portion if they understand how it is obtained?
2026-05-13 19:58:12.1778702292
On
Simple but confusing trigonometry to find angle (PID control for autonomous car)
143 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
Use the cosine formula for the two right triangles in your diagram,
$$AB = b\cos\alpha= a \cos (\alpha+\theta)$$
Then, use the identity
$$\cos (\alpha+\theta)=\cos\alpha \cos\theta -\sin\alpha \sin\theta$$
to get
$$b\cos\alpha= a \cos\alpha \cos\theta -a\sin\alpha \sin\theta$$
Divide by $\cos\alpha$ to obtain
$$\tan\alpha = \frac{ a\cos\theta-b}{a\sin\theta}$$
As a result, the distance is
$$AB = \frac{ab\sin\theta}{\sqrt{a^2-2ab\cos\theta+b^2}}$$

I think that you will find the following image helpful:
Now simply note that in the pink triangle, tangent is opposite over adjacent.