Simple really. Mcrit increases with altitude as Mach number is a ratio of velocity of flight and local speed of sound. Speed of sound decreases with altitude therefore, as you go up, you are dividing by a smaller value. Hence for constant airspeed, Mcrit will get bigger as you go up.
As for formulas:
Speed of sound at sea level is near enough
340 m/s which is 660 kts
at 40000' which is in the stratosphere, so you can assume a constant temperature of 216 Kelvin, gives speed of sound to be 295 m/s which is 572 knots.
The formula is:
M = squareroot(1.4*287*temperature)
M is the Mach number
1.4 is the ratio of specific heats for air
287 is the gas constant, R in J/KgK
and the temperature must be in Kelvin