What's the easiest way to find a decreasing exponential function passing through two given points?
$(x_1,y_1)$ and $(x_2,y_2)$ are given.
All coordinates are $\ >\ 3$.
What's the easiest way to find a decreasing exponential function passing through two given points?
$(x_1,y_1)$ and $(x_2,y_2)$ are given.
All coordinates are $\ >\ 3$.
To somewhat expand on Julián's solution in the style of Américo's and Niel's answers, note that if the equation we're after is $y=Ae^{kx}$ (and so $y_1 = Ae^{kx_1}$ and $y_2 = Ae^{kx_2}$ as above), then by taking logarithms we have $\ln y_1 = (\ln A)+(\ln e^{kx_1}) = (\ln A)+kx_1$ and $\ln y_2 = (\ln A)+kx_2$. Setting $b=\ln A$, $z_1 = \ln y_1$ and $z_2 = \ln y_2$ puts this in the form $z_1 = b+kx_1$ and $z_2 = b+kx_2$, and the usual techniques for fitting a line through two points (as Julián notes) apply; we get $k$ immediately as $\displaystyle {(z_2-z_1)\over (x_2-x_1)}$ and then $b$ by plugging this value of $k$ in to either equation; finally, the value of the original variable $A$ is recovered as $e^b$.
Use logarithms. Find the straight line that passes through $(x_1,\log y_1)$ and $(x_2,\log y_2)$. Then exponentiate.
If you write $y=Ae^{-kx},\tag{1}$ then you get the following system of two equations
$ \left\{ \begin{array}{c} y_{1}=Ae^{-kx_{1}} \\ y_{2}=Ae^{-kx_{2}}, \end{array} \right. $
whose solution is:
$ \left\{ \begin{array}{c} k=-\frac{\ln \left( \frac{y_{1}}{y_{2}}\right) }{x_{1}-x_{2}}=-\frac{\ln \left( y_{1}\right) -\ln \left( y_{2}\right) }{x_{1}-x_{2}}, \\ \\ A=\frac{y_{1}}{e^{\dfrac{\ln \left( y_{1}\right) -\ln \left( y_{2}\right) }{x_{1}-x_{2}}x_{1}}}=y_{1}e^{-\dfrac{\ln \left( y_{1}\right) -\ln \left( y_{2}\right) }{x_{1}-x_{2}}x_{1}}. \end{array} \right. $
The constant $k$ follows from $\frac{y_{1}}{y_{2}}=e^{-k(x_{1}-x_{2})}$, because $\ln \left( \frac{y_{1}}{y_{2}}\right)=-k(x_{1}-x_{2})$. From $y_{1}=Ae^{\frac{\ln \left( \frac{y_{1}}{y_{2}}\right) }{x_{1}-x_{2}}x_{1}}$ follows the constant $A$. Thus
$y=y_1e^{\dfrac{\ln (y_1)-\ln (y_2)}{x_1-x_{2}}(x-x_1)}.\tag{2}$
Remark: I assumed the base $b$ of the exponential is $e$. If $b\neq e$ one would have to addapt the algebraic calculations accordingly. For instance, if $b=10$, the result is
$y=y_{1}\times 10^{\dfrac{\log _{10}(y_{1})-\log_{10}(y_{2})}{x_{1}-x_{2}}(x-x_{1})}.\tag{3}$
Example: $\left( x_{1},y_{1}\right) =\left( 4,14.7\right) $, $\left( x_{2},y_{2}\right) =\left( 8,5.4\right) $
Here's an alternative presentation of the solution presented by Américo Tavares.
The general equation is meant to be of the form $y = A \mathrm e^{k x}$; and in particular, you know that $\begin{align} y_1 \;&=\; A \mathrm e^{\textstyle k x_1} & (\ast) \\ y_2 \;&=\; A \mathrm e^{\textstyle k x_2} \;. & (\ast\ast) \end{align}$ You would like to solve for $A$ and $k$. In particular, you'd like to get an equation which involves either $A$ or $k$, which does not include the other, so that you can isolate one of them and obtain its value. One way you can do this is by taking the ratio of equations $(\ast)$ and $(\ast\ast)$ to cancel out the $A$s: $\begin{align*} \frac{y_1}{y_2} \;=\; \frac{A \mathrm e^{\textstyle k x_1}}{A \mathrm e^{\textstyle k x_2}} \;&=\; \mathrm e^{\textstyle k x_1} \mathrm e^{\textstyle -k x_2} \\&=\; \mathrm e^{\textstyle k x_1 - k x_2} \\&=\; \mathrm e^{\textstyle k(x_1 - x_2)}\;. \end{align*}$ Now, $k$ is in the exponent: in order to isolate it, you should take the logarithm of both sides of the equation. $\begin{align*} k(x_1-x_2) \;=\; \ln\left(\frac{y_1}{y_2}\right) \;=\; \ln(y_1) - \ln(y_2)\;. \end{align*}$ The rest should be straight-forward. Good luck!