Q:

Logarithmic problem with 2 variables help

How on earth do I solve? Any help will be much appreciated. 
The value of $M$  is given by    $M =  a \log_{10}S    +   b$.
Note: Seismic moment measure the energy of the earthquake.
Using the following information, determine the values of $a$ and $b$ and hence find  the seismic moment $(S)$ of an earthquake which has a magnetic moment $(M)$ of $7.9$.  
Seismic Moment $(S) = 4.47 \times 10^{25}$,  Magnetic Moment $(M) = 7$
Seismic Moment $(S) = 2 \times 10^{27}$,  Magnetic Moment $(M) = 7.5$

A:

You have
\begin{align}
M=a\log_{10}S+b
\end{align}
Then, from the given values you have
\begin{align}
7=a\log_{10}(4.47\times10^{25})+b\tag1
\end{align}
and
\begin{align}
7.5=a\log_{10}(2\times10^{27})+b\tag2
\end{align}
Subtract $(1)$ from $(2)$ yield
\begin{align}
7.5-7&=a\log_{10}(2\times10^{27})+b-(a\log_{10}(4.47\times10^{25})+b)\\
0.5&=a\log_{10}(2\times10^{27})-a\log_{10}(4.47\times10^{25})\\
0.5&=a(\log_{10}(2\times10^{27})-\log_{10}(4.47\times10^{25}))\\
0.5&=a\log_{10}\left(\frac{2\times10^{27}}{4.47\times10^{25}}\right)\\
a&=\frac{0.5}{\log_{10}\left(\frac{2\times10^{27}}{4.47\times10^{25}}\right)}
\end{align}
The value of $b$ can be obtained by substituting $a$ to $(1)$ or $(2)$.

\begin{align}
7&=\frac{0.5}{\log_{10}\left(\frac{2\times10^{27}}{4.47\times10^{25}}\right)}\log_{10}(4.47\times10^{25})+b\\
b&=7-\frac{0.5\log_{10}(4.47\times10^{25})}{\log_{10}\left(\frac{2\times10^{27}}{4.47\times10^{25}}\right)}
\end{align}

