# Condition number of a 5-diagonal matrix

I'm trying to compute/estimate the condition number of the $N\times N$ matrix \begin{align*} \begin{pmatrix} 1 & 0 & -1 & & \\ 1 & 4 & 1 & & \\ & 1 & 4 & 1 & \\ & & \ddots & \ddots & \ddots \\ & & & 1 & 4 & 1 \\ & & & & 1 & 4 & 1 \\ & & & & 1 & 0 & -1 \end{pmatrix} \end{align*} as $N \to \infty$.

Numerically I have computed the condition number for as many of these as I could stand to type into Octave ($N < {\sim}8)$, but I was unable to deduce any conclusions from it. However, I suspect that this matrix is simple enough that someone on Math.SE might be able to get an expression/estimate for it's eigenvalues, and hence get the condition number. Help me out!

Here is the condition number versus $N$, computed numerically: It appears that the asymptote is roughly 6.9.

Hope this helps!

Mathematica code (non-optimized):

Clear[n, substitutions];

basicMatrix[n_]:= SparseArray[
{Band[{1,1}]->4,
Band[{2,1}]->1,
Band[{1,2}]->1},
{n,n}];

substitutions[n_] :=
{{1, 1} -> 1,
{1, 2} -> 0,
{1, 3} -> -1,
{n, n - 2} -> 1,
{n, n - 1} -> 0,
{n, n} -> -1};

conditionnumbers =
Table[{i,
(Last[mydone =
Sort@N@Abs@
Eigenvalues[
ReplacePart[basicMatrix[i], substitutions[i]]]]/
First[mydone])},
{i, 4, 40}];

ListPlot[conditionnumbers]

• That did help! Do you mind posting the code you used to compute this? – user14717 Feb 23 '17 at 2:27
• I'm wondering, however, if there is logarithmic growth, instead of an asymptote. If Mathematica is using QR under the hood, we'd never be able to see it, but if they have some sparse routines then it could get pretty high. – user14717 Feb 23 '17 at 2:37
• I ran my code up to $N=100$ and plotted on a log scale. (While there are fast methods for calculating the largest eigenvalues, condition number requires the largest and smallest, so no speedup is available.) Regardless: seems like an asymptote... but I'll let you do the full analysis. – David G. Stork Feb 23 '17 at 2:40