# Problem with solving a system of equations based on a matrix

I am trying to solve a system of equations based on a matrix in order to find the "stationary" matrix. the code I've written should break the matrix down into a system of equations such that some matrix "s" does the following s*p=s And it works great with any matrix except an absorbing one. What seems to be happening is that when it sees the equation x=x it just replaces it with "true" and then the solver loses one of the equations needed to actually solve it.

My current code is

P = ( {
{1, 0, 0},
{0, 1, 0},
{.2, .4, .4}
} );
round = .01;

Table[Array[x, Length[P]].Part[P, i] ==
Part[Array[x, Length[P]], i], {i, 1, Length[P]}]

Solve[Union[
Table[Array[x, Length[P]].Part[P, i] ==
Part[Array[x, Length[P]], i], {i, 1, Length[P]}],
{Total[Array[x, Length[P]]] == 1}]]


which gives the following results

{True, True, 0.2 x + 0.4 x + 0.4 x == x}
{{x -> 0.6 - 0.8 x, x -> 0.4 - 0.2 x}}


So if anyone has any advice on how to keep the "true" part of the code from happening, (or point out that's not my real problem) I would much appreciate the advice.

• This means that your system of equations is underdetermined, and some variables (like x in this case) can have any value and still satisfy the equations. Apr 25, 2019 at 6:00

Why not use the following:

sol = Solve[Array[x, {3,3}] . P == Array[x, {3,3}], Flatten[Array[x, {3,3}]]]


Solve::svars: Equations may not give solutions for all "solve" variables.

{{x[1, 3] -> 0., x[2, 3] -> 0., x[3, 3] -> 0.}}

r = Array[x, {3,3}] /. sol[]


{{x[1, 1], x[1, 2], 0.}, {x[2, 1], x[2, 2], 0.}, {x[3, 1], x[3, 2], 0.}}

Check:

r . P == r //Chop


True

In other words, there are 6 free parameters.