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


2 Answers 2


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'.

  • $\begingroup$ I didn't even notice that "linear equation" in this case meant just linear in x. So obviously this is the blindingly simple answer. $\endgroup$
    – Jens
    Aug 10, 2013 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).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.