Skip to main content

Minus Forty - A Useful Number for Temperature Conversion

· 2 min read
Software Engineer

Most of us know that 32 degrees Fahrenheit is the temperature at which water freezes. We also know that this correlates to 0 degrees Celsius. But for many of us, our knowledge stops there and to convert between the two scales we must resort to either looking it up using some sort of app or calculating it by hand using a formula that in involves multiplying by either nine-fifths of five-ninths and adding or subtracting 32 and we often have to lookup the formula to remember which.

Instead, I suggest simply remembering one more number: -40. Minus forty degrees is the same on both scales. In other words, -40 Fahrenheit is -40 Celsius. By committing this little fact to memory, we now have enough information to reconstruct the conversion formula:

40C40F0C32F-40 ^\circ C \rightarrow -40 ^\circ F \\ 0 ^\circ C \rightarrow 32 ^\circ F
slope=32(40)0(40)=7240=95slope = \frac{32 - (-40)}{0 - (-40)} = \frac{72}{40} = \frac{9}{5} F=95C+bF = \frac{9}{5}C + b \\ b=32(95)(0)=32b = 32 - \Big(\frac{9}{5}\Big)\Big(0\Big) = 32

Thus, our final conversion formula to convert from Celsius to Fahrenheit is:

F=95C+32F = \frac{9}{5}C + 32

We can also generate plots of the conversions using the following MATLAB/Octave script.

%% Temperature Conversion
close all; clear all; clc;

F = [-40 32];
C = [-40 0];

% Fahrenheit to Celsius
f = linspace(-100, 100, 2000);
c = polyfit(F, C, 1);

subplot(2,1,1)
hold on
grid on
grid minor
plot(f, c(1)*f + c(2), 'b')
plot(F(1), C(1), 'ro')
plot(F(2), C(2), 'ro')
hold off
xlabel('Degrees Fahrenheit');
ylabel('Degrees Celsius');


% Celsius to Fahrenheit
c = linspace(-100, 100, 2000);
f = polyfit(C, F, 1);

subplot(2,1,2)
hold on
grid on
grid minor
plot(c, f(1)*c + f(2), 'b')
plot(C(1), F(1), 'ro')
plot(C(2), F(2), 'ro')
hold off
xlabel('Degrees Celsius');
ylabel('Degrees Fahrenheit');