Think of the problem this way. First, as usual, one makes some "simplifying assumptions." Assume that the Earth and Mars are both in circular orbits about the Sun. Not too bad an assumption for this purpose, actually. So, what trajectory would we like our spaceship to take? We'd like for it to undergo an elliptical orbit about the Sun, an orbit which tangentially intersects both the orbit of the Earth and the orbit of Mars. For reference, let Earth's orbit have a radius of be 1 A.U. from the Sun; then Mars' orbit has a radius of 1.52 A.U.
Imagine firing the rocket's engine until it attains a velocity v_0 that is oriented tangent to the Earth's orbit. Then the engine is turned off, and the rocket will begin to orbit the Sun in an elliptical orbit. Using the spreadsheet from last time, one could adjust v_0 and plot the orbit that results; for some particular value of v_0, the new elliptical orbit will extend out to the orbit of Mars. An example of a solution is shown in the Figure below:
To arrive at this figure, I manually adjusted v_0 in the spreadsheet we used last time (PlanetOrb.xls ). Starting with the condtions
x=0, y=-1, vx=v_0, and vy=0I varied v_0 until I got the desired result. I found that v_0 = 2*pi * 1.098 = 6.899 works pretty well.
To check, how would we calculate the required speed?
As usual, we employ the laws of conservation of energy and momentum to arrive at the formula:
v_0^2 = 2 GM / r0 / ( 1 + r0/r)
where r0 is the radius of the Earth's orbit, and r is the radius of Mars' orbit. Plugging in numbers you should find that v_0 is in very good agreement with what was found with the spreadhseet.
Now that we can compute the required speed of the rocket, the remaining question is "When do we fire the engines?" If we launch the rocket when the earth is at x=0, y=-1, as in the above graph, then we want Mars to be at x=0 and y = +1.52 when the rocket arrives at that point! So, that means there is a particular time at which the launch needs to take place. This is why rockets cannot be launched on their space missions at just any 'ole time. By looking at our spreadsheet calculation, I find that the rocket reaches the desired coordinates somewhere around time t = 0.710 and 0.725. That is, in about eight and a half months. (Remember, t is in Years in our spreadsheet.) This also tells us that there is a bit of a "launch window" of opportunity for setting off our rocket. Much outside of that time window, and the rocket and Mars will not meet up.
So, the rocket must be launched at a specific time, such that after its 8.5 month journey, Mars ends up opposite the sun from where the Earth was located at launch time. And all of this can be readily estimated using a spreadsheet program, using the definitions of velocity and acceleration, and application of Newton's Universal Law of Gravtiation.