Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I've seen similar questions, but none worded quite like what I'm asking here. I'm not a math major, so I may have follow-up questions if answers befuddle me.

Scenario: I'm trying to emulate a rabbit's "hop" in computer software (this is 2D, BTW)

Question: If I know where the rabbit is standing (p1) and where the rabbit is hopping to (p2), how can I create a formula that achieves an arc or parabola (either would suffice, but a parabola seems to make more sense, since the distances will sometimes vary).

Additional Info:

  1. When the Y values of p1 and p2 are the same, I would like a specific height of the apex (vertical height of apex = half of the distance between the X values of p1 and p2).
  2. When the Y values of p1 and p2 are different, I need to determine a reasonable height for the apex that doesn't look ridiculous (how could I specify a reasonable focus?).

If I have asked in the wrong place, I will happily follow links to the right place. Thanks in advance!

share|improve this question
Do you want a formula for the arc of the parabola, i.e. $y$ in terms of $x$, or do you want a parameterization, i.e. both $x$ and $y$ as functions of time $t$? –  Chris Taylor May 24 '12 at 15:48

2 Answers 2

Here's a simple way to parameterize it. Let's say that the horizontal distance the rabbit would travel if his starting and ending heights were the same is $d$.

First suppose that the rabbit starts and ends at the same height, and that it takes 1 time unit to make the jump. Then $d=p_2-p_2$, then you can choose its $x$ and $y$ coordinates as a function of time to be

$$x(t) = dt\tag{1}$$ $$y(t)=2dt(1-t)\tag{2}$$

which gives the starting and ending positions correctly, and ensures that the rabbit is at height $d/2$ halfway through the jump. If you like, you can substitute one into the other to get

$$y = 2x(1-x/d) \tag{3}$$

Now suppose that instead, the horizontal distance of the jump is different from $d$. That is, he would jump the distance $d$, but the vertical height of his landing place is different, so he is either cut short (if he's jumping up) or he goes a bit further (if he's jumping down). We can use the formula (3) as above, but demand that when his vertical height is $\Delta y=y_2-y_1$, he has moved a total horizontal distance $\Delta p=p_2-p_1$:

$$\Delta y= 2\Delta p(1-\Delta p/d)$$

which you can rearrange to give $d$ in terms of the other parameters:

$$d = \frac{(\Delta x)^2}{\Delta x - \tfrac{1}{2}\Delta y}$$

You can now use formula (3) with this value of $d$ to get the rabbit's path, or if you want a parameterization in terms of time, then use formulas (1) and (2) with this value of $d$.

If you want the rabbit to take $T$ seconds to do the jump, rather than 1 second, then simply replace $t$ with $t/T$ on the right-hand side of formulas (1) and (2).

share|improve this answer
Thank you, I will post back after I get a chance to try these suggestions! –  C. Griffin May 24 '12 at 16:05

In case 1, where the $y$-values of your two points are the same, let's say $P_1=(x_1,y_1)$ and $P_2=(x_2,y_1)$ and the peak height is $H$, then $$y=-\frac{4(H-y_1)}{(x_1-x_2)^2}\left(x-\frac{x_1+x_2}{2}\right)^2+H.$$

In case 2, let's say the points are $P_1=(x_1,y_1)$ and $P_2=(x_2,y_2)$ and the peak height is $H$, then $$y=-\frac{2\sqrt{(H-y_1)(H-y_2)}}{(x_1-x_2)^2}\left(x-x_v\right)^2+H$$ where $$x_v=\frac{(x_1-x_2)(H(x_1-x_2)+x_2y_1-x_1y_2)-(x_1-x_2)^2\sqrt{(H-y_1)(H-y_2)}}{(x_1-x_2)(y_1-y_2)}.$$

share|improve this answer
Thanks for these formulas! I'm going to try all of the suggestions mentioned here this evening when I get home. You guys are fast! –  C. Griffin May 24 '12 at 16:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.