Constructing a parabola from two coordinate values and a peak height. I am trying to create a parabola function that mimics projectile trajectory. It will input the following:


*

*2 xy coordinates (the starting projectile position and the landing projectile position)

*Height of the throw


And will output the following:


*

*A parabola where the turning point is at the height.

*The parabola should also intersect the starting and ending throwing positions.


How can I go about doing this?
I attached a picture to illustrate what I am trying to do.

So in this case. The inputs will be (-1, 1), (1, 3.5) and 4 as the height of the throw
 A: You can solve the problem (surprisingly enough) by solving a system of linear equations. The second degree polynomial that gives rise to the parabola will be of the form 
$$f(x) =A x^2 + B x + C.$$
To get the parabola you want we need to solve $A$, $B$ and $C$. If you set three points of the parabola, say $(x_1,y_1)$, $(x_2,y_2)$ and $(x_3,y_3)$, you are in fact telling the value of the polynomial $f$ in three points; $f(x_1) = y_1$ etc. This means that by putting the values in $f$ you get three linear equations with three unknowns, namely $A$, $B$ and $C$:
$$
\begin{cases}
 A x_1^2 + Bx_1 + C = y_1 \\
A x_2^2 + Bx_2 + C = y_2 \\
A x_3^2 + Bx_3 + C = y_3 \\
\end{cases}
$$
Solve for $A$, $B$ and $C$ as in linear algebra and you have your parabola.
Also, you can use similar methods to share secrets.
A: For any point $(x, y)$ on a parabola with vertex $(h, k)$, we have the proportion $(x-h)^2\propto(y-k)$, or $|x-h|\propto\sqrt{|y-k|}$.  Since we know what $y_1$, $y_2$ and $k$ are, we can find some possibilities for $h$.
We have:  $|x_1 - h| \propto \sqrt{|y_1-k|}$ and $|x_2 - h| \propto \sqrt{|y_2-k|}$.  This then gives two possibilities:  $x_1-h$ has the opposite sign of $x_2-h$, or they have the same sign.  We'll cover the first, first, assuming WLOG that $x_2>x_1$.
We know that $x_2 - h + h - x_1 = x_2 - x_1$; Also, that $h$ will be, proportionally, $|x_1 - h| / (x_2 - x_1)$ along that part.  But that's $|x_1 - h| / \left(|x_1-h| + |x_2-h|\right)$, and we can calculate all those.  $$t=\frac{\sqrt{|y_1-k|}}{\sqrt{|y_1-k|}+\sqrt{|y_2-k|}}$$
$$h = (1-t)x_1+tx_2$$
For us, this gives $$t=\frac{2}{2+\sqrt{\frac{3}{2}}}=\frac{8-2\sqrt{6}}{5}\approx0.62$$ and $$h=\frac{11-4\sqrt{6}}{5}\approx 0.24$$
Which, ultimately, gives us the parabola
$$y=-\frac{11+4\sqrt{6}}{8}x^2+\frac{5}{4}x+\sqrt{\frac{3}{2}}+\frac{29}{8}$$
In the same fashion we can use 
$$t=\frac{\sqrt{|y_1-k|}}{\sqrt{|y_1-k|}-\sqrt{|y_2-k|}}$$
to get 
$$t=\frac{2}{2-\sqrt{\frac{3}{2}}}=\frac{8+2\sqrt{6}}{5}\approx2.58$$
$$h=\frac{11+4\sqrt{6}}{5}\approx 4.16$$
$$y=-\frac{11-4\sqrt{6}}{8}x^2+\frac{5}{4}x-\sqrt{\frac{3}{2}}+\frac{29}{8}$$
Here those are graphed.  The narrower one uses the first $t$ and $h$.

A: This is my first attempt at answering a question on math.stackexchange, so if I fall short of best form, please provide suggestions for improving the answer.
Given a launch point at $(x_1, y_1)$, a landing point at $(x_2, y_2)$, and a maximum altitude $k$, we want the equation for a parabola, $y=ax^2+bx+c$ , opening downward that includes those points and has its vertex at $(h,k)$.
We note that the problem can be solved with a parabola where $(x1,y1) = (0,0)$ by translation to the origin, and with a parabola where $x2=1$ by scaling in the x axis. We also note that $0<h<1$. As the parabola includes the origin, we know that $c=0$.
As we have reduced the problem to finding $a$ and $b$ for a parabola defined by $y=ax^2+b$, we have
[1] $y_2 = a \cdot 1^2 + b \cdot 1 = a + b$
and
[2] $k=ah^2+bh$
as $y' = 2ax+b$, we have
[3] $0=2ah+b$
This provides three equations in three unknowns $a,b,h$, which is determined, but Equation 2 is non-linear. This is not fatal, but it can be problematic depending upon the order in which we eliminate unknowns by substitution.
We can transform the problem into a system of three linear equations, however, by taking note that the parabola is symmetrical around the line $x=h$. The parabola contains $(1,y_2)$. Thus, it contains $(h+(1-h), y_2)$. As $x=h$ is the line of symmetry, this means the parabola also contains $(h-(1-h), y_2)$, or $(2h-1, y_2)$. So, we also have
[4] $y_2=a(2h-1)^2+b(2h-1)$
Expanding the terms in [4] produces
[5] $y_2 = 4ah^2-4ah+a+2bh-b$
Multiplying [2] by four and subtracting the product from [5], we eliminate the non-linear term:
[6] $4k-y_2 = 4ah-a+2bh+b$
[1], [3], and [6] are a system of linear equations in three unknowns, and can be solved by substitution, yielding
$$b = 2k +2\sqrt{k^2-ky_2}$$
$$a=y_2-b$$
$$h=-b/2a$$
Note that, if $0<k$ and $y_2<k$, which would be the case in any physical scenario where an object was launched upward from the origin to a maximum height of $y=k$, and falling back downward to a height of $y=y_2$, this solution guarantees that $a\ne0$, so $h$ is always defined.
