Tridiagonal Symmetric Matrix Could anyone help me to find the determinant of a $N\times N$ tri-diagonal symmetric matrix, named "$A[i,j]$" with $i,j \le N$, that has all the elements in the super-diagonal and sub-diagonal equal, and in the main diagonal all the elements are also equal, except for $A[1,N]$ and $A[N,N]$, that are different of others but are equal to each other. 
 A: If we have a tridiagonal matrix $(a_{ij})$, we can find its determinant by sweeping it into an right upper matrix $(b_{ij})$.
The schema is:
\begin{aligned}
b_{11}&=a_{11} \\
b_{22}&=a_{22}-\frac{a_{21}}{a_{11}}a_{12} \\
b_{33}&=a_{33}-\frac{a_{32}}{a_{22}}a_{23} \\
...
\end{aligned}
After that the determinant is:
$$D = \prod_i b_{ii}$$
A: For a general $N \times N$ tridiagonal matrix $A$, define:
$$d_i = A_{i,i}, \, i=1 \dots N \\
u_i = A_{i,i+1}, \, i=1 \dots N-1 \\
l_i = A_{i+1,i}, \, i=1 \dots N-1 \\
f_0 = 1 \\
f_1 = d_1 \\
f_n = d_n f_{n-1} - u_{n-1} l_{n-1} f_{n-2}, \, n = 2 \dots N$$
Then $\text{det}(A)=f_N$.
In your situation, $u_i \equiv s$, $l_i \equiv s$, and $d_i \equiv d$ for $i=2,\dots,N-1$ and $d_1=d_N=c$. So you solve the constant coefficient recursion relation
$$f_0 = 1 \\
f_1 = c \\
f_n = d f_{n-1} - s^2 f_{n-2}, \, n \geq 2$$
up to $n=N-1$, then finally
$$f_N = c f_{N-1} - s^2 f_{N-2}$$
Solving these, we get two cases. If $d^2 \neq 4s^2$:
$$\text{det}(A) = c \left ( \alpha \left ( \frac{d + \sqrt{d^2-4s^2}}{2} \right )^{N-1} + \beta \left ( \frac{d - \sqrt{d^2-4s^2}}{2} \right )^{N-1} \right ) - s^2 \left ( \alpha \left ( \frac{d + \sqrt{d^2-4s^2}}{2} \right )^{N-2} + \beta \left ( \frac{d - \sqrt{d^2-4s^2}}{2} \right )^{N-2} \right ) $$
If $d^2 = 4s^2$, then
$$\text{det}(A) = c \left ( \alpha \left ( \frac{d}{2} \right )^{N-1} + \beta (N-1) \left ( \frac{d}{2} \right )^{N-1} \right ) - s^2 \left ( \alpha \left ( \frac{d}{2} \right )^{N-2} + \beta (N-2) \left ( \frac{d}{2} \right )^{N-2} \right )$$
In both cases one finds $\alpha$ and $\beta$ from the conditions $f_0=1$, $f_1=c$.
This was taken essentially from http://en.wikipedia.org/wiki/Tridiagonal_matrix#Determinant.
A: Using the elimination method suggested by I like Serena, if $M_{11} = M_{NN} = c$ and all other $M_{ii} = a$ and the super and sub diagonals are all $b$, then the determinant is
$$
\frac{1}{a} (ac-b^2)^2 \left( c - \frac{b^2}{a} \right)^{N-3}
$$
