Momentum operator expression In the course of calculating 
$$\langle x|\hat{p}|\psi\rangle$$
I have a step which is:
$$ \langle x|\frac{\hbar}{i}\frac{d}{dx}|\psi\rangle=\frac{\hbar}{i}\frac{d}{dx}\langle x|\psi\rangle.$$
What is the mathematical justification for that step?
I am "intuitively" thinking that $-i\hbar d/dx$ and $ \langle x|$ "commute", but on second thought, that doesn't seem reasonable, since a bra and an operator are not even in the same vector space. 
 A: That is not the point really. The momentum operator is defined to be the operator which acts on the position basis as
$$\langle x |P |\psi\rangle = -i\hbar \dfrac{d}{dx}\langle x|\psi\rangle.$$
This is a definition. Recall that given one state $|\phi\rangle$ on the Hilbert space of the system, it is completely defined if you give its projections onto a complet set (be it discrete or continuous). To see this notice that if you know that
$$\langle x|\phi\rangle=\phi(x)$$
for a given $\phi(x)$, then using the completeness relation
$$\mathbf{1}=\int_{\mathbb{R}}|x\rangle \langle x| dx$$
you obtain that
$$|\phi\rangle = \mathbf{1}|\phi\rangle=\int_{\mathbb{R}}|x\rangle \langle x|\phi\rangle dx = \int_{\mathbb{R}} \phi(x)|x\rangle dx.$$
Now let $|\psi\rangle$ be one state, you want to define what is $P|\psi\rangle$. Whatever that is, it is another state. So it suffices to specify its projection onto the position basis, and that is exactly the expression above.
On the other hand: why is it reasonable that
$$\langle x|P|\psi\rangle = -i\hbar \dfrac{d}{dx}\langle x|\psi\rangle$$
is another, and considerably more interesting question. 
This is essentialy the idea of quantization. Basically when you have a classical system you have one Hamiltonian description which includes one Poisson bracket $\{,\}$.
If $q,p$ is one pair of canonically conjugate variables (position and momentum) then the relation $$\{q,p\}=1$$ holds, and it is telling that $p$ is the generator of translations in $q$. 
In order to preserve this in the quantum theory and still have that the quantized $P$ is the generator of the quantized $Q$ we need that
$$\{,\}\mapsto -\dfrac{i}{\hbar}[,].$$
Notice that this means $[Q,P]=i\hbar$, which is the way, in the language of quantum mechanics, of saying that $P$ generates translations in $Q$. This is roughly speaking one possible way to motivate the quantization prescription which should in some sense "deform" the Poisson bracket to the commutator. Another way to motivate this is to notice that $[Q,P]=i\hbar$ is equivalent to Heisenberg's uncertainty principle.
Notice that $[Q,P]=i\hbar$ is one algebraic relation between the operators. This is interesting because you can shift the point of view: instead of first thinking about states (in QM the Hilbert space) and then of the observables (the operators), we can talk about the observables of the system in one abstract way.
This means you need to talk about the so-called $\ast$-algebras. This is the abstract version of the algebra of operators in a Hilbert space. On the other hand, if you have one $\ast$-algebra you can talk about representations of this algebra, which in turn are the way that set with its algebraic operations can be realized as actual operators in some Hilbert space.
Thus if you have one classical algebra of observables with some Poisson bracket, you can talk about quantization as finding one quantum algebra of observables, the $\ast$-algebra, where we have the commutation relations holding as the quantized Poisson bracket.
The relation $[Q,P]=i\hbar$ is called the canonical commutation relation and roughly speaking if one builds the (abstract) algebra on which $[Q,P]=i\hbar$ holds, then there by Stone-Von Neumann's theorem there is precisely one and only one representation of this algebra up to unitary equivalence. This representation is the one on which the Hilbert space is $L^2(\mathbb{R})$ the space of square integrable complex functions, $Q$ acts on $L^2(\mathbb{R})$ as $Q\psi(q)=q\psi(q)$ and $P$ acts on $L^2(\mathbb{R})$ as
$$P\psi(q)=-i\hbar \dfrac{\partial \psi}{\partial q}.$$
This is the so-called Schrödinger's representation. This justifies the usual approach on which one assumes one abstract Hilbert space $\mathscr{H}$ together with operators $Q,P$ satisfying $[Q,P]$ and a basis $|q\rangle$ such that $Q|q\rangle = q|q\rangle$ and $P$ acts as we have discused. Notice that mapping $|\psi\rangle \mapsto \psi$ where $\psi(q)=\langle q|\psi\rangle$ identifies $\mathscr{H}$ with the Schödinger representation.
In summary: $[Q,P]=i\hbar$ is equivalent to existing a representation on which $Q$ acts as multiplication and $P$ as the derivative and in turn requiring $[Q,P]=i\hbar$ is what we mean by quantizing a system with classical $\{q,p\}=1$.
