Finding K so that exponential divided by factorial is maximum

112 Views Asked by At

I am trying to find the value of k so that it is maximum, but not reaching to any conclusion, please help how should we approach to it

enter image description here

2

There are 2 best solutions below

1
On

When $k$ increases by one, $\dfrac{r^k}{k!}$ becomes $\dfrac{r^{k+1}}{(k+1)!}=\dfrac{r^k}{k!}\dfrac{r}{k+1}$. You can easily conclude by comparing the value of $\dfrac{r}{k+1}$ to $1$.

0
On

Yves Daoust provided a full sense answer.

If you want another look at the problem, maximizing a function if the same as maximizing its logarithm. So, making the problem more general and using the same notations as Yves Daoust, let us consider $$f(k)=\frac{r^k}{k!}\implies g(k)=\log(f(k))=k\log(r)-\log(k!)$$ Now, use Stirling approximation $$\log(k!)=k (\log (k)-1)+\frac{1}{2} \log (2 \pi k )+O\left(\frac{1}{k}\right)$$ which makes $$g(k)\sim k\log(r)- k (\log (k)-1)-\frac{1}{2} \log (2 \pi k )$$Since we want $g(k)$ to be maximum, compute the derivative with respect to $k$; this gives $$g'(k)\sim -\frac{1}{2 k}-\log (k)+\log (r)$$ and you want it to be zero $$g''(k)\sim\frac{1}{2 k^2}-\frac{1}{k}$$ Since we expect $k$ not to be small, you see that a very first approximation could be $k_0=r$ and the second derivative test reveals that this is a maximum.

If you want to do it more accurately, why not to use $$\log(k_{n+1})=\log(r)-\frac 1 {2k_n}\implies k_{n+1}=r\ e^{-\frac 1 {2\,k_n}}$$ For illustration purposes, let us try using $r=123.456$. The iterates would then be $$\left( \begin{array}{cc} n & k_n \\ 0 & 123.4560000 \\ 1 & 122.9570111 \\ 2 & 122.9549902 \\ 3 & 122.9549820 \\ \end{array} \right)$$ while the "exact" solution of the problem would be $k\approx 122.955663$. Now, round the result to the next integer.

You should notice that they did not ask for the value at the maximum. Lucky you are, since the result would be quite large.

Edit

There is a very good approximation for the $k$ such that $$f(k)=\frac{r^{ak}}{k!}=\frac{\left(r^a\right)^k}{k!}$$ which can write as $$g(k)=\log(f(k))=k \log(r^a)-\log(k!)$$ $$g'(k)=\log \left(r^a\right)-H_k+\gamma\sim \log \left(r^a\right)+\log \left(\frac{1}{k}\right)-\frac{1}{2 k}+O\left(\frac{1}{k^2}\right)$$ which leads to $$k\sim -\frac{1}{2 W\left(-\frac{1}{2}r^{-a}\right)}$$ where appears Lambert function.

Using your case $(r=101,a=\frac 12)$, this will give $k=9.53654$ while the exact solution would be $9.54573$.

For the worked case $(r=123.456,a=1)$, this will give $k=122.95498$ while the exact solution would be $122.95566$.