When the speed of sound is known, the Mach number at which an aircraft is flying can be calculated by
where:
: M is the Mach number
: u is velocity of the moving aircraft and
: c is the speed of sound at the given altitude (more properly temperature)
and the speed of sound varies with the thermodynamic temperature as:
where:
:  is the ratio of specific heat of a gas at a constant pressure to heat at a constant volume (1.4 for air)
:  is the specific gas constant for air.
:  is the static air temperature.
If the speed of sound is not known, Mach number may be determined by measuring the various air pressures (static and dynamic) and using the following formula that is derived from Bernoulli's equation for Mach numbers less than 1.0. Assuming air to be an ideal gas, the formula to compute Mach number in a subsonic compressible flow is:
where:
: q is impact pressure (dynamic pressure) and
: p is static pressure
:  is the ratio of specific heat of a gas at a constant pressure to heat at a constant volume (1.4 for air)
The formula to compute Mach number in a supersonic compressible flow is derived from the Rayleigh supersonic pitot equation: