The compression of the air caused by rapid passage though it causes a rise in local density. The density is raised by a factor which is a function of the Mach No. The formula is a series expansion which takes the following form:
Compressibility = ( 1 + M squared/4 + M to the fourth/40...)
That's usually enough terms. M is Mach No in the above formula.
Thus at M 0.5 the density increase is approximately 6% and when M = 1.0,the increase is about 28%. Above Mach 1, the formula breaks down.
This does not lend itself to any kind of easy mathematical breakdown, so the correction is usually applied by tables or by the use of a compressibility correction window on a pilots' nav computer such as the CRP-5.