Computing the Initial Velocity of an orbiting body

I'm working on a simulation program that replicates the movement of planets around a large celestial body (the sun). This is a three dimensional simulation that uses vectors. At present, I'm struggling to work out how to calculate the correct initial velocity vector so that the planet will enter into a stable orbit around the sun. I've attempted to take the vector cross product of v1 and v0 but to no avail. I also attempted to calculate..

$T_0 = v_1 - v_0$

$T_1 = v_0 - v_1$

$NV = T_0 * T_1$

Where NV is the new velocity and * is the cross product function. This resulted in a zero vector because $T_0$ is parallel to $T_1$ so I find myself somewhat stuck. Does anyone know how to compute the correct vector?

migrated from math.stackexchange.comDec 6 '14 at 10:20

This question came from our site for people studying math at any level and professionals in related fields.

• The motion is planar: do you want the plane is the screen and the sun a fixed point on the screen ? – Tony Piccolo Nov 29 '14 at 14:59
• The sun is fixed at {0,0,0}. I don't know what "the motion is planar" means though. Sorry. – notverygoodatmaths Nov 29 '14 at 15:07
• It means that the trajectory is on a plane. – Tony Piccolo Nov 29 '14 at 15:13
• Okay, and how do I decide/work out that plane? – notverygoodatmaths Nov 29 '14 at 15:14
• Choose the initial position and the initial velocity of the planet: the plane of motion contains the (center of the) sun and the initial position of the planet and is parallel to the initial velocity of the planet. One plane ! – Tony Piccolo Nov 29 '14 at 15:22

The planet will follow an elliptical path and as an ellipse is a 2D figure it can only be traced to a plane and from two points infinite planes can pass, so you need to decide first which plane you want which is the missing information, because of which you are not able to do so. If finally you form a plane $\vec r.\vec N=p$ then the direction of the velocity vector of the planet is given by $\pm\vec N \times(\vec v_1-\vec v_0)$ the sign depending upon in which sense you want your planet to move clockwise or anti clockwise. On a paralle note the magnitude of velocity should be: $$\frac{GMm}{|\vec v_1-\vec v_0|^2}=\frac{m|\vec v|^2}{|\vec v_1-\vec v_0|}\implies |\vec v|=\sqrt{\frac{GM}{|\vec v_1-\vec v_0|}}$$ where $G$ is the universal gravitation constant and M and m the mass of sun and the planet respectively.You must play with values so that it looks very real Great help here