2

I am trying to solve simple, small linear systems, with parameters. I would like to have the result shown for various values of the parameter. RowReduce[], Solve[], LinearSolve[], Reduce[], etc., all show "generic" solutions, without special values for the parameters. (Note that Wolfram|Alpha does show this extra analysis.)
If the matrix of coefficients is square, Det[] helps to find the parameter values of interest:

m = {{1, 1, k}, {1, k, 1}, {k, 1, 1}};
FindInstance[Det[m] == 0, k, Reals, 3]

produces: {{k -> -2}, {k -> 1}}.
However, I would like to work with non-square coefficient matrices as well.
I have tried MatrixRank[], e.g.:

FindInstance[MatrixRank[m] < 3, k, Reals, 3]

which just produces: {}. The same goes for all of the other functions which perform elimination (NullSpace[], RowReduce[], amongst others).
Any suggestions how to make this work?
Thank you

Editing: I was trying to keep it simple. For example:

FindInstance[MatrixRank[m] == 2, k, Reals, 3]

I would want the output of: {{k -> -2}} . I think if I can understand that, I will be able to handle the rest, and would be happy to include it here, once I have done that.

Aharon Naiman
  • 1,173
  • 6
  • 13
  • An example that provides the full generality, along with desired output, would be helpful. – Daniel Lichtblau Feb 04 '18 at 23:40
  • 2
    Maybe something along these lines: `In[604]:= Solve[ Apply[PolynomialLCM, Flatten[Denominator[ RowReduce[Join[m, IdentityMatrix[Length[m]], 2]]]]] == 0]

    Out[604]= {{k -> -2}, {k -> 1}}`

    – Daniel Lichtblau Feb 05 '18 at 19:22
  • 1
    Thank you! That did the trick -- for rectangular coefficient matrices as well, retaining the divisions of interest in the augmented part of the matrix. (I just added Reals to the Solve[].) Since I was looking at rectangular systems as well, I used PseudoInverse[] and noticed the parameters of interest in the denominators. However, with the parameters sometimes in the coefficient matrix, sometimes on the right hand side of the equation, and sometimes in both, while this worked almost always, I found a couple of cases that it did not. – Aharon Naiman Feb 06 '18 at 12:25

1 Answers1

1

I have made a MatrixRankSym feature with symbolic computation here. And we can use for your this question directly:

FindInstance[MatrixRankSym[m] == 2, k]

{{k -> -2}}

Or we can use Reduce to get the analytical solution:

Reduce[MatrixRankSym[m] < 3, k, Reals]

k == -2 || k == 1

yode
  • 26,686
  • 4
  • 62
  • 167