# Determinant of a large matrix and solution of a linear equation

I am trying to solve a linear equation in x, where the equation is given by Det[M]==0. The M is a symmetric matrix (dimensions 47x47) with an element equal to x and all other elements are equal to numbers ranging from 1 to 10^4. So, Det[M] is a linear equation in x. I could get a solution for a 11x11 matrix using 'Solve', but when the dimensions goes to 47 the program does not return anything for the time I let it run (about a day). I suspect it is the large size that causes the problem, any suggestion to solve it quickly (~ mins) using Mathematica? Thanks. Jayajit

• – Jens Aug 10 '13 at 16:54
• Maybe you could show us your code for a small-order case like 3 by 3 or 5 by 5? – bill s Aug 10 '13 at 17:04
• I guess this isn't a duplicate, given the linearity in x which makes this problem especially simple. – Jens Aug 11 '13 at 2:58

Evaluate M at two substituted values for 'x', say 0 and 1. Interpolate to find the linear form for Det[M]. Set that linear polynomial to zero and solve for 'x'.

• I didn't even notice that "linear equation" in this case meant just linear in x. So obviously this is the blindingly simple answer. – Jens Aug 10 '13 at 23:29

Reorder the rows and columns (maintaining symmetry) to put x into either the (47,47) position or the (46,47) and (47,46) positions, then use the theorems on determinants of partitioned matrices.

EDIT I too didn't notice the linearity in x, which implies that x must a diagonal element.
In that case, if m is the matrix in question and x is the kth diagonal, the solution is
With[{r = Delete[Range@47,k]}, m[[k,r]].LinearSolve[m[[r,r]],m[[k,r]]]]
Note that it is not necessary to reorder m or to set m[[k,k]] = x symbolically.
Whatever is in m[[k,k]] is simply ignored.

That's not as elegant as Daniel's solution, but it's about 30% faster on my system (although it hardly matters -- they're both well under 1 sec, compared to > 1 day).