While solving a PDE using the Eigenfunction expansion method, I approximated the following function with an infinite sum: $$ f(x) = (1-x)e^{-kx} = \sum_{n=0}^\infty A_n \cos(w_nx) \tag 1 $$ where $x \in [0, 1]$, $w_n=(n+1/2)\pi$, and: $$ A_n = 2 \frac{e^{-k}}{\!\Big(k^2+w_n^2 \Big)^{\!2}} \Bigg(\!\! \Big(k^2-w_n^2 \Big) \cos(w_n) + e^k \Big(k^2(k-1) + w_n^2(k+1)\Big) - 2kw_n\sin(w_n)\!\Bigg) \tag 2$$
I made a graph to check my approximation. It seems correct as shown below. I call the function without the infinite sum a closed from function. The graph is constructed for $k=30$ and $n_{max} = 100001$. I used $100$ points for the $x$ axis.
I know that if $k$ tends to infinity that this function will be defined as:
$$ \lim_{k \to \infty} f(x)=\Bigg \{\begin{matrix} 1 & \text {if} & x=0\\ 0 & \text {if} & x>0 \end{matrix} \tag 3$$
which I also checking using the graph given below, where $k$ was changed to $677$:
I wanted to prove that the infinite sum converges to $1$ if $x=0$ and $k$ tends to infinity:
$$ \lim_{k \to \infty} f(0) = \lim_{k \to \infty} \sum_{n=0}^\infty A_n = \sum_{n=0}^\infty \lim_{k \to \infty} A_n =1 \tag4$$
I was hoping that after I reformulate the expression for $A_n$ as $k$ tends to infinity, it would be easy to prove that the infinite sum converges to $1$.
I rewrote the expression for $A_n$ as:
$$A_n = B_n+C_n+D_n \tag 5$$
where:
$$ B_n = 2{ e^{-k}\Big(k^2-w_n^2 \Big) \cos(w_n) \over \Big(k^2+w_n^2 \Big)^2} \tag 6$$
$$C_n = 2{ k^2(k-1)+w_n^2(k+1) \over \Big(k^2+w_n^2 \Big)^2} \tag 7$$
$$D_n = -4{ e^{-k} kw_n\sin(w_n) \over \Big(k^2+w_n^2 \Big)^2} \tag 8$$
Next, I tried solving $$\lim_{k \to \infty} A_n = \lim_{k \to \infty}B_n + \lim_{k \to \infty}C_n + \lim_{k \to \infty}D_n \tag 9$$
The first term is easy to solve because $\cos(w_n)$ is equal to zero since $w_n$ represents the roots of the cosine function:
$$ \lim_{k \to \infty}B_n = \lim_{k \to \infty}2{ e^{-k}\Big(k^2-w_n^2 \Big) \cdot 0 \over \Big(k^2+w_n^2 \Big)^2}=0 \tag {10}$$
I solved the second term by multiplication of the enumerator and demoninator with $1/k^4$:
$$ \lim_{k \to \infty}C_n = \lim_{k \to \infty}2{k^3-k^2+kw_n^2+w_n^2\over k^4+2k^2w_n^2+w_n^4}=\lim_{k \to \infty}2{{1 \over k} - {1 \over k^2} + {w_n^2 \over k^3} + {w_n^2 \over k^4}\over 1 + {2w_n^2 \over k^2}+{w_n^4 \over k^4}}=0 \tag {11}$$
Also, I calculated: $$ \lim_{k \to \infty}D_n = \pm 4{ e^{-k} kw_n \over \Big(k^2+w_n^2 \Big)^2} = 0 \tag{12} $$
I thought I made a mistake somewhere in my calculations of $B_n$, $C_n$ and $D_n$ as $k$ tends to infinity. However, I tried plotting $B_n$, $C_n$ and $D_n$ with respect to $k$ for $n = \{0, 1, 2 \}$. It really does seem that they tend to zero as $k$ gets bigger as shown in the graphs below:
However, that seems to me like a contradiction to the fact that $f(0) = 1$. So my question is, where did I go wrong here? How can I prove that the inifinite sum defined by $(4)$ is equal to $1$ and did I really calculate the limits correctly or not?



First, I should prove that the sum converges to $1$ regardless of the value of $k$, which would actually even cover the case where $k$ tends to infinity.
Thank you @Conard. Would you please write an answer so I can accept it?
– FriendlyNeighborhoodEngineer Nov 17 '23 at 20:12