I am trying to calculate the eigenvalues of the discrete second order derivative, with both Neumann and mixed Dirichlet-Neumann boundary conditions. I'm following the derivation here: https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative#Neumann_case
But there are some things I don't understand for each derivation.
Neumann boundary conditions
For a grid of $n$ points, the problem corresponds to finding the eigenvalues of the $n\times n$ matrix
\begin{equation}
\frac{1}{h^2}\,
\begin{pmatrix}
-1 & 1 & & & 0\\
1 & -2 & 1 & & \\
& 1 & \ddots & \ddots & \\
& & \ddots & \ddots & 1 \\
0 && & 1 & -1
\end{pmatrix}
\end{equation}
where $h$ is the grid spacing, which I will set to be unity. Unfortunately, there are a few things I don't understand. They define $\vec{v}$ to be the eigenvector corresponding to an eigenvalue $\lambda$. They state that the eigenvalue problem corresponds to solving the problem
$$
v_{k+1} – 2v_k + v_{k-1} = \lambda v_k \quad \Rightarrow \quad v_{k+1} = \left(\lambda+2\right) v_k – v_{k-1}
$$
This is true, but not for all $k$ and it bugs me that this is not stated. Is this not important? Instead of working with $v_k$, they work with $w_k$, which is defined
$$
w_k = v_{k+1} – v_k \quad \Rightarrow \quad w_k- w_{k-1} = v_{k+1} – 2v_k + v_{k-1}
$$
This can be used to find a recursive expression for the $w$'s.
$$
w_{k+1} =(2+\lambda) w_k – w_{k-1} = 2\alpha w_k – w_{k-1}
$$
They then state that the boundary conditions are $w_0 = w_n = 0$. But why? $w_0 = v_1 – v_0 = v_1$ and $w_n = v_{n+1} – v_n = -v_n$. I don't see why either of these should be zero.
Best Answer
The eigenvalue equation $v_{k+1} - 2v_k + v_{k-1} = \lambda v_k$ is actually true for all $k$. I think your confusion is in the introduction of the dummy variables $v_0$ and $v_{n+1}$ and in your mixing the Neumann and Dirichlet boundary conditions.
The variables $v_{0}$ and $v_{n+1}$ are introduced specifically to ensure that $v_{k+1} - 2v_k + v_{k-1} = \lambda v_k$ is true for all $k$, but they have different values for the Neumann and Dirichlet conditions: $$ \text{Neumann condition:} \quad v_0 = v_1 \quad v_{n+1} = v_n.$$ $$ \text{Dirichlet condition:} \quad v_0 = 0 \quad v_{n+1} = 0.$$ What you wrote in your calculation of $w_0 = v_1 - v_0$ and $w_n = v_{n+1} - v_n$ was a combination of these two mutually exclusive conditions which is why you obtained the contradiction $w_0 = v_1 - v_0 = v_1 = 0$ and the analogous one for $w_n$.