TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to write the matrix equation A = (x y) B (x y)^T, where (x y)^T is written as a column vector and B is a 2x2 matrix written as such. I can (almost) do this by, for example, the following:

A = (x \ y) \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}

But I'd like the row vector (x y) to be aligned with the first row of the matrix B. How do I do this?

share|improve this question
up vote 7 down vote accepted

For consistency's sake, I would also use a pmatrix for the first matrix; then you can wrap the first pmatrix inside a matrix with an empty second row:



A = 
  \begin{matrix}\begin{pmatrix}x & y\end{pmatrix}\\\mbox{}\end{matrix}
  \begin{pmatrix} a & b \\ c & d \end{pmatrix} 
  \begin{pmatrix} x \\ y \end{pmatrix}


enter image description here

share|improve this answer
Come to think of it, is this type of equation typically formatted to have the row vector in line with the first row of the matrix? – Matt Jan 6 '12 at 15:46
@Matt: No. I have never seen it like that at least. Row vectors are usually just set in the same way as scalars. – Roelof Spijker Jan 6 '12 at 15:55
Funny, I always do it this way by hand, but never considered typesetting it like this. – qubyte Jan 6 '12 at 16:06
@Matt This would be mistaken for a kind of exponent; leave it in the middle. What would you do for the product of a 2x4 matrix by a 4x3 one? – egreg Jan 6 '12 at 16:12
@MarkS.Everitt, I always do it that way by hand too, but it just doesn't look right when typesetting. Sorry! – Matt Jan 6 '12 at 16:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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