How are matrices used to represent quantities, and what is the meaning of a matrix? So I'm reading this text on Quantum Mechanics, and it goes through a few chapters that I understand fairly well including probability.  But then it says that all quantities, like position and energy of an object, are represented in a matrix, and that quantities have associated probability distributions.  I kind of get this, although I'm a little unclear about whether we're talking about full m-by-n matrices or just vectors.  If it's vectors, yeah, I'm sort of familiar with that.  But if not, how do you use a full m-by-n matrix to represent a quantity?
And then further along, it says that $\langle M\rangle$ is the mean of a matrix, but doesn't say what that is.  Is it the average of all the coordinates in the matrix, so it's
$$\displaystyle \frac{1}{mn}\sum_{(i,j)\in \ulcorner m \urcorner \times \ulcorner n \urcorner}a_{ij} \, ,$$
or are each of the columns supposed to represent separate quantities and then I guess the mean is a vector of the means of the columns?
The only guidance the text gives in this regard is "Some of the basic rules of quantum mechanics involve simple relations between quantities, expressed in terms of matrices, and corresponding relations between mean values.  Consider a quantity represented by a matrix $M$.  Let $\langle M\rangle $ denote its mean value.  For any number $z$, the matrix $zM$ represents the original quantity multiplied by $z$.  Its mean value is $\langle zM\rangle=z\langle M\rangle$."  And so on.  But nowhere does it define the mean of a matrix, it just jumps into this notation.  Some quick websearching showed that there doesn't seem to be any consensus on what is meant by the mean of a matrix representing a quantity.
 A: Disclaimer at the bottom. I'm assuming we're working with the infinite (continuous position) case. A few things that may help you:


*

*In quantum mechanics, $\langle \hat{A} \rangle$ is usually defined to be $\langle \psi | \hat{A} | \psi \rangle=\langle \psi | \hat{A}  \psi \rangle$. If you're not given $\psi$ you can't find $\langle \hat{A} \rangle$, which would explain your difficulty in finding a definition. It isn't referred to as the average, usually, it is referred to as the expectation value of the operator over psi.

*With regards to the position operator, the wikipedia page states that it is motivated by the fact that the expected x-position should be: $\langle \hat{x} \rangle=\int x |\psi(x)|^2 dx=\int \psi^* x \psi dx=\int \psi^* \hat{x} \psi dx=\langle \psi |\hat{x} |\psi\rangle$, where $\hat{x}$ is the operator defined in the position representation to be $\hat{x} \psi(x)=x \psi(x)$.

*I think there are other motivations for the position operator. One feature it has is that if $| X \rangle$ is an eigenvector of $\hat{x}$, then the inner product $\langle X | \psi \rangle$ gives you the value of $|\psi\rangle$ at position $|X\rangle$. $|X\rangle$ in the position representation in this case is a delta function, $X(x)=\delta(x-x_0)$, so that  $\langle X|\psi \rangle=\psi(x_0)$, which is perfect because it picks out a sharp value of $\psi$ as desired.


The conceptual weirdness and the fact that I'm being so inspecific (in terms of $| \psi \rangle$ instead of $\psi(x)$) is because you're working in a vector space (of all $\psi$) and you can change basis at will, and so the position representation truly isn't fundamental (mathematically, at least - I'm not so sure about physically). 
So, short version: 


*

*$\langle \hat{A} \rangle=\langle \psi | \hat{A} | \psi \rangle
= \int \psi^*(x) \hat{A}\psi(x)dx  $  (the last only holds in the position representation)

*$\hat{x}$ is an operator (matrix in the finite dimensional case), its eigenvectors $|X\rangle$ are vectors, and you can use the inner product $\langle X | \psi \rangle$ to pick out the value of the wavefunction at position $|X\rangle$.

Disclaimer: I'm still on very, very, very shaky ground on QM, so please correct me if I'm wrong.
