The matrix $Q$ with dimensions $n\times2*n*m$ is structured by $$Q=[B|AB|\cdots|A^{2*n-1}B]$$ where $Q$ is an augmented matrix built from a $3\times3$ matrix, $A$, and a $3\times2$ matrix, $B$.

I need $\DeclareMathOperator{\rank}{rank}\rank(Q)<n$ but I get $\rank(Q)=n$.

If I RowReduce matrices $A$ and $B$ before that calculation the $Q$ matrix has $\rank<n$ as I want, but its elements aren't the ones I need to continue, but 0's and 1's.

Any Idea on how to get the desired $Q$ matrix?

If I multiply $Q$ by $Q_\text{reduced}$ (with dimensions $2*n*m\times n$) I get an $n\times n$ matrix, $W$ with $\rank(W)=n$, so that's not what I want.

I've no Idea how to implement the Mathematica code here. Any suggestions would be helpful.

  A0 = RandomInteger[{1, 10}, {4, 4}],
  B0 = RandomInteger[{1, 10}, {4, 3}],
  A1 = RowReduce[A0],
  B1 = RowReduce[B0],
  m = 3,
  n = 4,

  (*Original Matrices Proc *)
  Do[Lnn[j] = MatrixPower[A0, j - 1].B0, {j, 2*n}],
  Do[Flatten[Lnn[j][[i]], m], {i, n}, {j, 2*n}],    
  M222 = Table[Lnn[j][[i]], {i, n}, {j, 2*n}],
  R222 = Flatten[M222],
  Qnn = Partition[R222, 2*n*m],
  η1 = MatrixRank[Qnn],
  {p1, r1} = Dimensions[Qnn],
  QN11 = RowReduce[Qnn],

  (*RowReduced Matrices used now *)
  Do[Lnn1[j] = MatrixPower[A1, j - 1].B1, {j, 2*n}],
  Do[Flatten[Lnn1[j][[i]], m], {i, n}, {j, 2*n}],    
  M22 = Table[Lnn1[j][[i]], {i, n}, {j, 2*n}],
  R22 = Flatten[M22],
  Qn = Partition[R22, 2*n*m],
  η = MatrixRank[Qn],
  {p, r} = Dimensions[Qn],
  QN = RowReduce[Qn],

  Print[MatrixForm[Qnn], MatrixForm[QN11]],
  Print[MatrixForm[Qn], MatrixForm[QN]]}];
  • 1
    $\begingroup$ I was going to format your text for you, but I find I am confused by your notation. What does Q=[B|AB|---|A^(2*n-1).B] mean? The use of the unmatched vertical lines (|) is unfamiliar to me. Also, what do you intend by ---, subtraction? $\endgroup$
    – rcollyer
    Jul 18, 2012 at 19:15
  • $\begingroup$ @rcollyer Q is a matrix that consists of submatrices. since A(3x3), n=3. so Q would be [B AB A^2.B A^3.B A^4.B A^5.B], the Routine: { Do[Lnn[j] = MatrixPower[A0, j - 1].B0, {j, 2*n}], Do[Flatten[Lnn[j][[i]], m], {i, n}, {j, 2*n}], M222 = Table[Lnn[j][[i]], {i, n}, {j, 2*n}], R222 = Flatten[M222], Qnn = Partition[R222, 2*n*m]} Creates the Matrix Q in the form I want so don't bother for Q that much. If you want to check it though, excecute this 5 manipulations appart and join B,Man1,Man2 etc the same matrix will occur. the RowReduce is my point after the formation of the matrix. $\endgroup$ Jul 19, 2012 at 4:19
  • $\begingroup$ RM explained it to me in the chat room. So, the vertical lines just indicate that $Q$ is an augmented matrix consisting of $B$, $AB$, $A^2B$, etc. $\endgroup$
    – rcollyer
    Jul 19, 2012 at 4:22
  • $\begingroup$ exactly, If I could post the .nb file it would be easier... though I can't get into chatroom yet! $\endgroup$ Jul 19, 2012 at 4:27
  • $\begingroup$ The point is that this Augmented matrix has to have rank<3 since it's an augmentation of 2 matrices ranked 3&2 but RowReduce can't show it to me. Nevertheless If I RowReduce the A&B matrice before the construction of Q I get a Q with row nullity and elements 0,1, but that's not what I need to continue... I don't know if I multiply Q(n,2*nm)xTranspose[Qred](2*nmxk) [k=Rank(Qred)<n] if the new matrix lets say W (nxk) would have {kxk} rows linear indipendend and {kx(n-k)} linear dependend to the first ones. $\endgroup$ Jul 19, 2012 at 4:36

3 Answers 3


Whether the Q matrix has rank $<n$ or not depends on the specific A and B. For instance, if B is a matrix of all zeroes, then Q is a matrix of all zeroes and so has rank $< n$.

You can test for the rank of Q using the MatrixRank[ ] function.

You can build Q from A and B using the function ControllabilityMatrix[ ].

For example, if a={{-1, 1, 0}, {0, -1, 0}, {0, 0, 0}} and b={{1, 0}, {1, 1}, {0, 0}}, the Q matrix is

q = ControllabilityMatrix[StateSpaceModel[{a, b}]]

and the rank is


which is 2.

Of course, Aristarchus is correct, if you build A and B from random integers (or random reals) then Q is full rank with probability one.


The Answer is no it can't!

Random Integer sets as Linear Independent the Columns B and the first column of the product AB, and linear dependent among these three all the others.

If you're an engineer and want to test this augmented Controllability Crit your system HAS to be NOT Controllable and implement the Static Feedback that makes it controllable.

  • $\begingroup$ The last statement is flat wrong. Controllability is not affected by state feedback. (But stability is. So if the system has modes that are unstable but controllable, they can be stabilized by feedback.) $\endgroup$ Jun 22, 2013 at 23:06

I think the key point you are missing is that RowReduce must be done on the transpose of $Q$.

Using the same example as bill s and the nifty way he pointed out to construct $Q$ using ControllabilityMatrix, we have:

a = {{-1, 1, 0}, {0, -1, 0}, {0, 0, 0}};
b = {{1, 0}, {1, 1}, {0, 0}};
Q = ControllabilityMatrix[StateSpaceModel[{a, b}]];

If we want to compute the span of the controllable space using RowReduce, this is what needs to be done.

span = Transpose[RowReduce[Transpose[Q]]]
(* {{1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}} *)

The controllable space is the span of the columns.

Of course, the dimension of the space will be the same whether we evaluate it using $Q$ or its span.

 MatrixRank /@ {Q, span}
 (* {2, 2} *)

(If we are working with the ObservabilityMatrix, then we need not go through Transpose to determine the span of the observable space.)


Your Answer

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

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