# What is the use of a transpose of a matrix in an equation and how to solve one?

I have the following equation to solve, $$g(x) = x^t W_i x + {W_i}^t x + v_{i_0}$$

In this equation why the need to use a $x^t$ and $x$? I feel $x$ and transpose of it both are the same ($x$ is a row vector with two values)

Additionally, when you have such a situation and when $w_i$ is another column vector with two components how can I solve it with the inner products given?

Imagine a situation where

$x = (x_1, x_2)$ and $W_1 = \binom{6}{3}$

Maybe my question sounds dumb, but I am very new to linear algebra, sorry about that.

Any help is deeply appreciated.

-
I tried to edit in order to put mark-up. Please double-check to see that I didn't introduce errors. – Arturo Magidin Mar 16 '12 at 19:30
$x$ and $x^t$ are not the same, since they have different dimensions. Remember that one cannot just multiply any two matrices, in order for a product $AB$ to make sense, the number of columns of $A$ has to match the number of rows of $B$. So, for instance, you would not be able to multiply two $1\times 2$ vectors, $vw$ but you could take the transpose of one and multiply it by the other, $vw^t$ (which would yield a $1\times 1$ matrix, i.e. a scalar). – Arturo Magidin Mar 16 '12 at 19:32
@ArturoMagidin, thanks, you really shed some light to they way I have earlier understood matrices. Some additional question, what is the order to multiply the following: (a scalar).(a 1X2 matrix). (a 2 X 2 matrix). (the transpose of the earlier 1X2 matrix). – picmate Mar 16 '12 at 19:45
If you are asking whether you do "scalar times $1\times 2$ matrix" first and then the result by the $2\times 2$ matrix, or if you do $1\times 2$ matrix by $2\times 2$ matrix first, and then multiply the scalar by the result, the answer is "It doesn't matter", because matrix multiplication is associative. If $A$ is $n\times p$, $B$ is $p\times q$, and $C$ is $q\times m$ (so that all the products are defined), then we have that $(AB)C = A(BC)$. If you did not mean that, then I don't understand your question. – Arturo Magidin Mar 16 '12 at 19:50
Yeah, that is exactly what I meant. Thank you. – picmate Mar 16 '12 at 20:04

Given $x = \begin{pmatrix} x_1 \\ x_2 \end{pmatrix}$ and $W_1 = \begin{pmatrix} 6 \\ 3 \end{pmatrix}$ then

$$x^\top\, W_1 = x_1*6 + x_2*3$$

which is a scalar, but

$$x \,W^\top = \begin{pmatrix} x_1*6 & x_1*3 \\ x_2*6 & x_2*3 \end{pmatrix}$$

which is a $2\times2$ matrix.

The first is the inner product, and the second is the outer product. Here I use $\fbox{ }^\top$ (\top in LaTeX) for the transpose operator.

-

We can't really tell unless we know the origin of this equation.

But anyways, obviously, the final result $g(x)$ is a scalar. That is, $1\times 1$ matrix. The dimensions of LHS has to match the dimensions of RHS. Also, the dimensions of any matrix-matrix (or matrix-vector) product has to match the rule $$\underbrace{A}_{m\times n} = \underbrace{B}_{m\times k} \times \underbrace{C}_{k\times n}$$

I can't find a pretty illustration off the web right now, but here is something from Wikipedia.

-
– user2468 Mar 16 '12 at 19:30
Thanks for the answer, the origin was when I was trying to find a Baysean classifier for two gaussian distributions. – picmate Mar 16 '12 at 19:48
Can I give an advice from a fellow learner to another? I know how concepts can be very confusing when you first learn them. I think you should read a tutorial on matrix multiplication from beginning to end. There are plenty of websites & YouTube videos that describe Matrix-Matrix and Matrix-Vector products. And you can always ask questions here on math.SE. Good luck :) – user2468 Mar 16 '12 at 20:14
Thanks J.D. That is true, and I find it always convenient to learn new things with places like SE and guys like you all. – picmate Mar 16 '12 at 23:16