understanding vector-matrix-vector operation in linear algebra This operation comes up a lot in linear systems:
$x^{T}Ax$
where $A$ is a (square) matrix and $x$ is a column vector. example:
$A = \begin{bmatrix}-1 & 0 & 0\\0 & -2 & 0\\0 & 0 & -3\end{bmatrix}$
$x = \begin{bmatrix}-5\\-6\\-8\end{bmatrix}$
the operation $Ax$ is an application of a linear transform (represented by the matrix) to a vector, which is typically the variables in the linear system. That's clear.
What does $x^TAx$ intuitively mean then? The result in the above example is:
$x^TAx = \begin{bmatrix}95\end{bmatrix}$
 A: This  $x^t A x$ pattern, in my experience, occurs most often when $A$ is a symmetric matrix (and if it's not, you can replace $A$ by $B = \frac{1}{2}(A + A^t)$, and the result will be the same). 
And even more often, $A$ is positive-definite symmetric, in which case it can be factored as $M^t M$ (that's a big theorem), so that 
$$
x^t A x = x^t M^t M x = (Mx)^t (Mx)
$$
which is the dot product of $Mx$ with itself, i.e., the squared length of $Mx$. You can think of $M$ as representing a change-of-coordinates, so this computation amounts to computing the length of $x$ in some different coordinate system, or alternatively, computing the length of $x$ in the standard coordinate system, but in some non-standard metric. 
Consider the matrix 
$$
M = \begin{bmatrix} 1 & 1 \\ 2 & 1 \end{bmatrix}
$$
Then 
$$
A = M^t M = 
 \begin{bmatrix} 5 & 3 \\ 3 & 2 \end{bmatrix}.
$$
Now for $x = M = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$, we have $x^t A x = 5$; we can regard this as an "distorted length", in which the length of a vector $
\begin{bmatrix} a\\b\end{bmatrix}$ is $5 a^2 + 6 ab + b^2$ instead of $a^2 + b^2$. The "unit circle" in this distance is an ellipse in the ordinary metric (and vice versa). 
Alternatively, you can say "If we just treat $$ \begin{bmatrix} 1 \\ -1 \end{bmatrix}$$ and $$\begin{bmatrix} -1 \\ 2 \end{bmatrix}$$ (the columns of $M^{-1}$) as our basis vectors -- i.e., we choose to measure coordinates with respect to a different coordinate system, then these two vectors are in fact orthonormal with respect to this allegedly-distorted metric." 
One may regard this as saying that for any ellipse (the "unit circle" for an arbitrary symmetric positive definite metric arising from a bilinear function), there's a linear transformation taking its maxor and minor axes to the standard basis for 2-space. 
In short: there are a lot of ways of looking at this. 
A: If the two vectors have the same number of entries, you're just talking about bilinear forms.
Essentially they're just a generalization of the dot product of vectors.
A: A matrix has m rows and n columns.
To multiply we go across and down 
To go across n columns we must go down n rows.
So we can multiply an $m\times n$ with a $n\times k$ matrix is an $m\times k$ matrix. Because we get $m$ rows, and $k$ columns in the result.
$x^TAx$ can be $x^T(Ax)$, let's deal with the $Ax$ case. 
$3\times 3$ multiplied by a $3\times 1$ is a $3\times 1$ matrix, a column vector to you.
Now $x^T$ is a $1\times 3$ matrix (row vector).
A $1\times 3$ multiplied by a $3\times 1$ is a $1\times 1$ matrix.
