Solving for $n$ in the equation $$\left ( \frac{1}{2} \right )^{n}+\left ( \frac{1}{4} \right )^{n}+\left ( \frac{3}{4} \right )^{n}=1$$
Can anyone show me a numerical method step-by-step to solve this? Thanks
Solving for $n$ in the equation $$\left ( \frac{1}{2} \right )^{n}+\left ( \frac{1}{4} \right )^{n}+\left ( \frac{3}{4} \right )^{n}=1$$
Can anyone show me a numerical method step-by-step to solve this? Thanks
On
There is no analytic solution for this problem. However, the LHS is monotonic, and as such easy to solve numerically using your method of choice.
On
Let $f(x)=\left ( \frac{1}{2} \right )^{x}+\left ( \frac{1}{4} \right )^{x}+\left ( \frac{3}{4} \right )^{x}-1$. Now note that $f(1)=\frac12$ and $f(2)=-\frac18$. Hence given that $$f'(x)=-4^{-x}(3^x \log\frac43+2^x\log 2+\log4)<0$$ there is one unique root in $(1,2)$. The rest is numerics, this could be approximated to $1.73051$.
On
You seem to want the details of a numerical method to find an good approximation for $x$. Here is one way, using the Newton-Raphson method, which is well-known and uses fewer steps than other famous methods.
We want to find the zeros of
$$f(x)=0.25^x+0.5^x+0.75^x-1$$
(I rearranged the terms to be in ascending order, which satisfies my sense of style. I also changed the fractions to decimals to make it easier to type into a calculator.) We already know from comments and other answers that $x=1$ is too low and $x=2$ is too high. So let's choose the average, $1.5$, as our initial guess $x_0$. We then use the recurrence
$$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$
This is what I typed into my graphing calculator (TI-Nspire CX):
$$x:=1.5$$ $$x:=x-\frac{0.25^x+0.5^x+0.75^x-1}{0.25^x\cdot\ln(0.25)+0.5^x\cdot\ln(0.5)+0.75^x\cdot\ln(0.75)}$$
That gave me the answer $$1.71161782284$$
which is $x_1$. Repeated presses of the [enter] key repeated the recurrence, and I got
$$1.73037816962$$ $$1.73050735181$$ $$1.73050735786$$ $$1.73050735786$$
More [enter]'s just repeated the last value. Therefore, an excellent approximation to your desired value, probably to $12$ significant digits, is $1.73050735786$.
On
The function : $$y=0.25^x+0.5^x+0.75^x-1$$ is decreasing.
For example $y(1)=2$ and $y(2)=-\frac{1}{8}$. So, the root for $y=0$ is between $x=1$ and $x=2$.
In this case, among many numerical methods, the dichotomic method is very simple. The successives values $x_k$ are : $$x_{k+1}=x_{k}+\frac{\delta_k}{2^k}$$ where $\delta_k=\pm 1$
the signe is $+$ if $y_k=(0.25^{x_k}+0.5^{x_k}+0.75^{x_k}-1) >0$
the signe is $-$ if $y_k<0$.
ALGORITHM:
$x:=1$
$d:=1$
repeat
$ \quad \quad d:=\frac{d}{2}$
$ \quad \quad y:=0.25^x+0.5^x+0.75^x-1$
$ \quad \quad $ if $y>0$ then $x:=x+d$ else $x:=x-d$
until $d<10^{-15} $
(or another limit depending on the wanted accuracy).
RESULT : $x=1.73050735785763$
Of course, the convergence is slower than with the Newton-Raphson method for example. But, in both casses, the time of computation is so small that this is negligible. On the other hand, the time spent in programming the algorithm is smaller with the dichotomic method : that is the most important point in practice.
On
As other answers already mentioned, we can notice that $f(1)=\frac12$ and $f(2)=-\frac18$ which mean that, more than likely, the solution is rather close to $x_0=2$. If we start Newton method at this point, the successive iterates are $$x_1=1.703616841$$ $$x_2=1.730245725$$ $$x_3=1.730507333$$ $$x_4=1.730507358$$ which is the solution for ten significant figures. You can notice that we have one overshoot of the solution because the iterations started at a point $x_0$ for which $f(x_0)f''(x_0) <0$.
It can be woth to mention that the convergence to the solution could be faster using higher order iterative methods. For example, starting at $x_0=2$, using Halley method (cubic convergence) the first iterate would be $1.733482269$ while using Householder method (quartic convergence) the first iterate would be $1.730170949$.
Edit
As Peter answered , the problem could be reset as $$f(x)=4^x-(1+2^x+3^x)$$ which is a very stiff function. However, if we consider instead $$g(x)=x\log(4)-\log(1+2^x+3^x)$$ the function is much more linear. Starting again Newton method at $x_0=2$, the successive iterates will now be $$x_1=1.722964808$$ $$x_2=1.730501219$$ $$x_3=1.730507358$$
You could also be interested by the fact that, expanding $g(x)$ as a Taylor series built at $x=2$ and limiting to second order, the solution of the quadratic equation gives an estimate which is $\approx 1.730171694 $.
On
Classic problem for Newton's Method.
Note that $F(n) = \dfrac{1}{2^n} + \dfrac{1}{4^n} + \dfrac{3^n}{4^n}-1$ is continuously differentiable. Furthermore, $F(0) = 2$ and $\lim_{n \rightarrow \infty} F(n) =-1$ so by the Intermediate Value Theorem, there is definitely a zero.
I used Maple to calculate the root to a tolerance of $10^{-15}$ because I can.
with(Student[NumericalAnalysis]):
F(z):= n-> 1/2^n + 1/4^n + 3^n/4^n:
Newton(F(z),n=0.2,tolerance=10^-15)
>>>1.73050735785764
On
A non-standard approach to get an approximate solution:
Notice that the sum $$\frac14\left(\frac120.00^n+0.25^n+0.50^n+0.75^n+1.00^n\frac12\right)$$ is the five-points trapezoidal approximation of $$\int_0^1t^ndt=\frac1{n+1}.$$ So,
$$f(n)=0.25^n+0.50^n+0.75^n\approx\frac4{n+1}-\frac12.$$ Hence, $f(n)=1$ when $$n\approx\frac53=1.66666\cdots.$$ Note that $$f(\frac53)=1.033304\cdots,$$not so bad.
$\left ( \frac{1}{2} \right )^{n}+\left ( \frac{1}{4} \right )^{n}+\left ( \frac{3}{4} \right )^{n}= \frac{2^n}{4^n} +\frac{1^n}{4^n} +\frac{3^n}{4^n} = \frac{1^n+2^n+3^n}{4^n}=1,\: \therefore 1^n+2^n+3^n=4^n $
I don't think this can be solved analytically, you just have to use trial and error with n