Operators and scalars in a binomial expansion, a Hamiltonian question I've encountered a Hamiltonian of the following form while studying quantum mechanical systems: 
$$ \hat H = \left[\left( \frac{\partial}{\partial x} + c \right)^2 + \cos x \right] $$
where c is a constant. I'm wondering how I can expand this expression, specifically the binomial expansion of an operator and a number. If we imagine the differential operator as a matrix like this
$$ \hat A = 
 \begin{pmatrix}
  0 & 1 & 0& \cdots &  \\
  0 & 0 & 1 & \cdots &  \\
  \vdots  & \vdots  & \vdots & \ddots  \\ 
 \end{pmatrix} $$
then we seem to get a contradiction because a matrix plus a scalar is undefined. 
Usually we would approach the Hamiltonian in the context of the Schr$\mathrm{\ddot o}$dinger equation, $$ \hat H \psi(x)=E\psi(x) $$ where $ \hat H$ to operates on $\psi(x)$, so the $\frac{\partial}{\partial x}$ operator can act on the function $before$ we add the operator and the scalar together, avoiding the problem above. But I'm also uncomfortable with this. Starting with this, 
$$ \left( \frac{\partial}{\partial x} + c \right)^2 \psi (x)$$ 
is it possible to expand like this? 
$$ \left(\frac{\partial^2}{\partial x^2} + 2 b\frac{\partial}{\partial x} + b^2 \right) \psi (x) = \frac{\partial^2\psi (x)}{\partial x^2} + 2b\frac{\partial \psi (x)}{\partial x} + b^2 \psi (x)$$
I've never learned any rules about how operators behave all by themselves during algebra and arithmetic. I usually like to think in terms of infinite matrices, but I'm worried about the contradiction above. 
Please help. How can I be sure that this binary expansion is in accordance with the axioms of mathematics. 
 A: The meaning of something like 
$A^2\psi(x)$ is that you apply $A$ twice in a row to $\psi(x)$.  In your specific case, with $c$ a number:
\begin{align}
\left(\frac{\partial}{\partial x}+c\right)^2\psi(x)&=
\left(\frac{\partial}{\partial x}+c\right)\left(\psi'(x)+c\psi(x)\right)\\
&=\psi''(x)+ 2c\psi'(x)+c^2\psi(x)
\end{align}
because $c$ commutes with $\partial_x$.  More generally, if you had an expression like $(A+B)^2\psi(x)$ you'd need to keep track of the ordering:
\begin{align}
(A+B)^2\psi(x)&=(A+B)(A\psi(x)+B\psi(x))\, ,\\
&=A^2\psi(x)+AB\psi(x)+BA\psi(x)+B^2\psi(x)
\end{align}
with no a priori reason to suppose that $AB=BA$.

Edit: I'm not sure why you would think that a differential operator is a matrix of the type you suggest.  You'd have to specify a basis for this.  
As an easy counterexample, given that $\partial_x\sim p_x$ up to some unimportant factors, one easily verifies that $\langle \psi_n\vert p_x\vert\psi_m\rangle$ for harmonic oscillator eigenstates $\vert\psi_m\rangle$ does not produce a matrix of the form your suggest.  Rather, $p_x$ is a hermitian matrix with non-zero entries when $m=n\pm 1$. 
A: Your scalar is an operator, namely this scalar times the identity, normally dropped to save superfluous symbols. 
Using the obvious operator identity (you may imagine an arbitrary function f on the right, if you are not used to operator calculus),
$$
\partial_x ~ e^{-cx}= e^{-cx} (-c+\partial_x),
$$
it follows that 
$$
e^{cx} \hat{H} e^{-cx}= \partial_x^2 + \cos x ~,
$$
evidently easier to address.  
Do you have experience with the 
Mathieu equation?
Edit in response to question : Well, clear and present danger indeed,
$$
\hat{H} \psi = E\psi  \qquad  \iff \qquad (\partial_x^2 + \cos x) ~(e^{cx} \psi) = E ~ (e^{cx} \psi)~.
$$
