How to find the coefficients of a parabola if only its focus and directrix are known

680 Views Asked by At

This is related to my previous question Explanation of method for finding the intersection of two parabolas.

I am trying to understand the math behind a piece of code that calculates the coefficients of a parabola ($a$, $b$ and $c$), knowning only its focus and directrix.

The relevant part of the code (in C++) is:

double dp = 2.0 * (p->y - y);
double a1 = 1.0 / dp;
double b1 = -2.0 * p->x / dp;
double c1 = y + dp / 4 + p->x * p->x / dp;

I know that p->x and p->y are the x and y of the focus and y is the y of the directrix.

And a1, b1 and c1 are the calculated coefficients of the standard form of the parabola equation.

The code is used only in a special case, where the directrix is always parallel to the x axis and the focus is always above the directrix.

My attempt at reconstructing the formulas from the code is:

$a = \frac{1}{2( y_{f} - y_{d})}$

$b = \frac{-2x_{f}}{2( y_{f} - y_{d})}$

$c = y_{d} + \frac{2( y_{f} - y_{d})}{4} + \frac{x_{f}^2}{2( y_{f} - y_{d})}$

where $x_{f}$ and $y_{f}$ are the $x$ and $y$ of the focus and $y_{d}$ is the $y$ of the directrix.

My question is are these well-known formulas for calculating the $a$, $b$ and $c$ coefficients given only information about the focus and directrix?

And what is the mathemathical proof for those formulas?

Update: how to calculate b:

Vertex form of parabola $x_{0}=-\frac{b}{2a}$

is simplified to $b = -2ax_{0}$,

and since $x_{0}$ of the vertex equals $x_{f}$ of the focus, $b = -2ax_{f}$,

and if $a = \frac{1}{2( y_{f} - y_{d})}$,

then $b = -2x_{f}.\frac{1}{2( y_{f} - y_{d})}=-\frac{2x_{f}}{2( y_{f} - y_{d})}$.

Update 3: a better explanation at calculation of $a$

According to Everything You (N)ever Wanted to Know About Parabolas there is a direct relation between $a$ and the distance between the focus and the vertex:

Focus and Directrix; Finally, it's important to note that the distance (d) from the vertex of the parabola to its focus is given by: $d = \frac{1}{4a}$

The distance between the focus and the directrx is two times this distance, so $d_{fd} = 2\frac{1}{4a} = \frac{1}{2a}$.

If we substitute the distance between the focus and directrix we get: $y_{f} - y_{d} = \frac{1}{2a}$.

Simplifying that leads to:

$2a = \frac{1}{y_{f} - y_{d}}$

and

$a = \frac{1}{2(y_{f} - y_{d})}$

Which shows how $a$ is calculated.

Update 4: how to calculate c:

First we expand the vertex form to standard form:

$y = a(x – h)^2 + k$

becomes

$y = ax^2 -2ahx + (ah^2 + k)$,

where the last part in brackets plays the role of the $c$ coefficient.

So we consider $c$ equal to the part in the brackets,

$c = ah^2 + k$

Since $h$ is the $x$ of the vertex, which is equal to $x$ of the focus, we replace $h$ with $x_{f}$.

$c = ax_{f}^2 + k$

And since $k$ (the $y$ of the vertex) is at distance $\frac{1}{4a}$ from the $y$ of the focus, we replace $k$ with $(y_{f} - \frac{1}{4a})$:

$c = ax_{f}^2 + y_{f} - \frac{1}{4a}$

Then we replace $a$ with the value that was already computed for it $\frac{1}{2( y_{f} - y_{d})}$:

$c = \frac{1}{2( y_{f} - y_{d})}x_{f}^2 + y_{f} - \frac{1}{4\frac{1}{2( y_{f} - y_{d})}}$

which simplifies to:

$c = \frac{x_{f}^2}{2( y_{f} - y_{d})} + y_{f} - \frac{2( y_{f} - y_{d})}{4}$

which is almost the same as the formula from the code, except that $y_{f}$ is used instead of $y_{d}$. As $y_{d}$ is at the same distance from the vertex, as is $y_{f}$, the only difference is the sign.

2

There are 2 best solutions below

5
On BEST ANSWER

Hint:

start from the definition:

a parabola is the locus of points $(x,y)$ that have the same distance from the directrix and from the focus.

Write this condition in your case and compare the result with your code.


If $P=(p_x,p_y)$ is the focus and $y=d_y$ is the equation of the directrix, the equation of the parabola is : $$ (x-p_x)^2+(y-p_y)^2=(y-d_y)^2 $$

0
On

Just look to the definition of a conic, how the present parabola special case is formed as a ratio ( =1 here) of distances

$$ ( x-x_f)^2+(y-y_f)^2 = (y-y_d)^2 $$

The parabola vertex lies exact vertical mid-point of directix and parabola focus.