To derive the theoretical equations for a moving shock, one may start by denoting the region in front of the shock as subscript 1, with the subscript 2 defining the region behind the shock.  This is shown in the figure, with the shock wave propagating to the right. 
The velocity of the gas is denoted by u, pressure by p, and the local speed of sound by a.
The speed of the shock wave relative to the gas is W, making the total velocity equal to u + W.  
Next, suppose a reference frame is then fixed to the shock so it appears stationary as the gas in regions 1 and 2 move with a velocity relative to it.  Redefining region 1 as x and region 2 as y leads to the following shock-relative velocities:
With these shock-relative velocities, the properties of the regions before and after the shock can be defined below introducing the temperature as T, the density as ρ, and the Mach number as M:
Introducing the heat capacity ratio as γ, the speed of sound, density, and pressure ratios can be derived:
One must keep in mind that the above equations are for a shock wave moving towards the right.  For a shock moving towards the left, the x and y subscripts must be switched and: