**1. The problem statement, all variables and given/known data**

An object (say, a spaceship, or something. Something that can accelerate/decelerate at a constant rate) has to travel a certain distance, and be at a certain velocity when it does so. The fastest way for the object to do so would be to accelerate until point h, then decelerate until it's reached the desired distance at the desired speed.

Given the object's initial velocity i, acceleration/deceleration rate a, target distance x, and target terminal velocity w, find the distance to point h.

Counterintuitive variable names follow: let y be the time at point h, u be the velocity at point h, and (y + t) be the time at point x

**2. Relevant equations**

h = ((i + u)/2)y = iy + (ay^2)/2

x = h + ((u + w)/2)t = h + ut - (at^2)/2

**3. The attempt at a solution**

...is clearly missing something elementary. And will look very, very ugly when expressed without LaTeX. My intentions were straightforward enough: since all the variables are interdependent, reduce them to expressions of the same variable (I opted for u), then express that variable through the given values (i, a, x, and w). Easier said than done.

((i + u)/2)y = iy + (ay^2)/2

(i + u)/2 = i + ay/2

(i + u)/2 -i = ay/2

(2((i + u)/2 - i))/a = y

y = (u - i)/a

h = ((i + u)/2)y

h = ((i + u)/2)((u - i)/a)

h = (u^2 - i^2)/2a

x = h + ((u + w)/2)t

x = (u^2 - i^2)/2a + ((u + w)/2)t

x + (i^2 - u^2)/2a = ((u + w)/2)t

t = (2x + (i^2 - u^2)/a)/(u + w)

At this stage, things look a mite messy even in legible notation, but at least we've managed to express each and every variable through u. Now, to expand said expressions and see how they relate to the constants, thereby getting the powerup and winning the game.

x = h + ut - (at^2)/2

x = (u^2 - i^2)/2a + u(2x + (i^2 - u^2)/a)/(u + w) - 0.5a((2x + (i^2 - u^2)/a)(2x + (i^2 - u^2)/a)/((u + w)(u + w)))

Oh. Oh,

*my*. At this stage, I have a sneaking suspicion the expression at the end of all this will be trivial, and therefore not what I'm looking for at all. And yet the expansion of t^2 alone is

(4x^2 + (4xi^2 - 4xu^2)/a + (i^4 - 2u^2i^2 + u^4)/a^2)/(u^2 + 2wu + w^2)

I haven't a clue how to begin extracting u from that mess. I may be relying on intuition overmuch, but I can't see how a problem this straightforward became this complex in my hands. Any advice would be appreciated.