What is the general formula for a diagonal parabola facing a given direction with a given vertex (x,y)?
$\endgroup$ 31 Answer
$\begingroup$The general equation is $$ y' = mx'^2 $$ where $y'$ and $x'$ are coordinates of a point in a rotated and transalted coordinate system. The good news is that if you're willing to write a point $(x, y)$ as a vector $v = \begin{bmatrix}x \\ y \\ 1\end{bmatrix}$, then the equation of a general parabola is just $$ v^t M v = 0 $$ where $M$ is the matrix $$ \frac{1}{2} \begin{bmatrix} 2d & 0 & 0\\ 0 & 0 & 1\\ 0 & 1 & 0\\ \end{bmatrix} $$
The case $d = 1$ corresponds to $y = -x^2$. $d = 2$ corresponds to $y = -(2x)^2$ etc. I went with $ y = -x^2$ to put fewer negative signs in the matrix, and hence give me some hope of getting things right. If you want $y = x^2$ instead, simply rotate by 180 degrees in the formula below (i.e., replace $t$ by $t + 180^\circ$.
If you want to rotate solutions to that equation by an angle $t$ (easier to type than $\theta$), you let
$$ R = \begin{bmatrix} \cos t & -\sin t & 0\\ \sin t & \cos t & 0\\ 0 & 0 & 1\\ \end{bmatrix} $$ and use the equation $$ v^t R^t M R v = 0 $$ This will have, as its solutions, the same parabola rotated by angle $t$ clockwise.
Writing $c$ for $\cos t$ and $s$ for $\sin t$, this becomes
$$ \frac{1}{2} \begin{bmatrix}x & y& 1\end{bmatrix} \begin{bmatrix} c & s & 0\\ -s & c & 0\\ 0 & 0 & 1\\ \end{bmatrix} \begin{bmatrix} 2d & 0 & 0\\ 0 & 0 & 1\\ 0 & 1 & 0\\ \end{bmatrix} \begin{bmatrix} c & -s & 0\\ s & c & 0\\ 0 & 0 & 1\\ \end{bmatrix} \begin{bmatrix}x \\ y\\ 1\end{bmatrix} = 0. $$ Multiplying through by $2$, and doing some matrix multiplies, this becomes $$ \begin{bmatrix}x & y& 1\end{bmatrix} \begin{bmatrix} c & s & 0\\ -s & c & 0\\ 0 & 0 & 1\\ \end{bmatrix} \begin{bmatrix} 2dc & -2ds & 0\\ 0 & 0 & 1\\ s & c & 0\\ \end{bmatrix} \begin{bmatrix}x \\ y\\ 1\end{bmatrix} = 0. $$ and then $$ \begin{bmatrix}x & y& 1\end{bmatrix} \begin{bmatrix} 2dc^2 & -2dcs & s\\ -2dcs & 2ds^2 & c\\ s & c & 0\\ \end{bmatrix} \begin{bmatrix}x \\ y\\ 1\end{bmatrix} = 0. $$ Written out without matrices, that's $$ 2dc^2 x^2 - 4dcs xy + 2ds^2 y^2 +2sx + 2cy = 0 $$
and you can substitute in $\cos t$ for $c$ and $\sin t$ for $s$.
To translate that to have its "vertex" at a point $(a, b)$, you could do a similar matrix trick, or something far simpler:
$$ 2dc^2 (x-a)^2 - 4dcs (x-a)(y-b) + 2ds^2 (y-b)^2 + 2s(x-a) + 2c(y-b) = 0 $$
And that's your answer. Dividing by 2 makes it a little prettier:
$$ dc^2 (x-a)^2 - 2dcs (x-a)(y-b) + ds^2 (y-b)^2 + s(x-a) + c(y-b) = 0. $$
$\endgroup$ 1