Why can operators be represented as matrices in quantum mechanics? I am studying introductory quantum mechanics in our undergraduate course. I saw that operators can be represented as matrices too. I can't figure out the proper reason. 
My attempt is: As operators are vector valued functions (more basically linear transformations), basis set exists for them. Hence they belong to the space spanned by this basis set. Hence it they act as vectors, they'll have components and matrices can be employed to represent them.
Am I correct or missing something?
 A: On a finite dimensional vector space, we have bases consisting of finite amount of elements: $\{e_1,...,e_n\}$, where $n$ is the dimension of the space. If $A$ is a linear operator on the space, then $A(e_j)$ is a vector for every allowed value of $j$, and as a vector, it can be expanded in the basis too: $$A(e_j)=\sum_{i=1}^nA_{ij}e_i.$$
If $v$ is an arbitrary vector, it can be expanded too, as $v=\sum_{j=1}^nv_je_j$. Then $A(v)=A\left(\sum_jv_je_j\right)=\sum_jv_jA(e_j)=\sum_jA_{ij}v_je_i$, so the $i$th component of $A(v)$ is $\sum_jA_{ij}v_j$ and this expression is representible as a matrix product between the $n$ by $n$ square matrix whose $ij$th element if $A_{ij}$ and the column matrix whose $j$th element is $v_j$.
But you already know this.
In quantum mechanics, we work on a separable Hilbert space. A separable space is one which has a countable dense subset. It can be shown that a Hilbert space admits an orthonormal basis if and only if it is separable. So "physical" Hilbert spaces admit orthonormal bases. By an orthonormal basis in an infinite dimensional Hilbert space, we mean a countable set $\{e_1,...,e_n,...\}\subset\mathcal{H}$, such that $\langle e_i,e_j\rangle=\delta_{ij}$ and for any $x\in\mathcal{H}$, a unique expansion is given as an infinite series in the form $x=\sum_{n=1}^\infty x_ie_i$.
Given an operator, we can do the same procedure on the infinite orthonormal basis as we did in the finite case to obtain an infinite matrix representation.
At this point I am not sure if such an expansion is possible rigorously only for bounded operators or all kinds of operators, but even if it is restricted to bounded operators we, as good physicists, usually ignore this issue and proceed without much problems as if the operators were bounded.
