<s>[INST] 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. 
 [/INST] 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.
</s>