It may seem easy to compute a general formula for the distance between a point on an ellipse and a point on the x-axis (maybe it is), but I can't work it out.

Here is the data and are the restrictions.

C is an ellipse with \frac{x^2}{a^2}+\frac{y^2}{b^2}=1. On this ellipse, we have a point p (not located on the x-axis) and the normal line (perpendicular to the direction of the curve) of C at p intersects the x-axis in q. In my image, the normal line is red.

Now I want to find out what the distance between p and q is.

I have worked out a parametrisation of the ellipse: f(t)=(acos(t),bsin(t)) and that gives me f'(t)=(-asin(t),bcos(t)) (this is the direction of the curve)

The direction of the normal line is then given by f''(t)=(-acos(t),-bsin(t)). I get lost at that point. I have some ideas but none of those really work.