The Piano Frequencies formula maps the position of a piano key on the standard piano n to a specific note and frequency e.g. key n=49 maps to A4 with a frequency of 440 hz.
$ f(n) = 440(\sqrt[12]2)^{n-49}$
Article about the formula here: https://en.wikipedia.org/wiki/Piano_key_frequencies.
My question is pretty simple: how do you re-arrange the equation so that you can find the specific piano note n given a frequency? For example, how do we solve for n in the equation below?
$ 27.5 = 440(\sqrt[12]2)^{n-49} $
I know from trial and error that the note f(n)=27.5 is A1 so n=1. But I had a lot of difficulty in approaching how to rearrange the equation and would appreciate some insight and help. Thanks in advance!
You have
\begin{align} f(n) &= 440(\sqrt[12]2)^{n-49} \\ &= 440 \left(2^{1/12}\right)^{n-49} \\ &= 440 \left(2^{(n-49)/12}\right) \\ &= 440 \left(2^{((n-1)/12) - 4}\right) \\ &= 440 \left(\frac1{16} 2^{(n-1)/12}\right) \\ &= 27.5 \left( 2^{(n-1)/12}\right) \end{align}
Dividing by $27.5$ on both sides,
$$ \frac{f(n)}{27.5} = 2^{(n-1)/12}, $$
and taking the base-$2$ logarithm on both sides we get
$$ \log_2 \left( \frac{f(n)}{27.5} \right) = \frac{n - 1}{12}, $$
so
$$ n = 1 + 12 \log_2 \left( \frac{f(n)}{27.5} \right). $$
In general the frequencies cannot be written exactly in decimal format and the calculations you do also will not be exact, so you will usually get a result that is not exactly an integer. Round to the nearest integer.