$A = \frac{d}{dx} + x \frac{d}{dx}$ is an operator that acts on the vector space $P^n$ of all real valued polynomials of degree $\le n$. with respect to the standard basis $\{x_n\}_{n\in \mathbb{N}_0}$. To find the linear operator I checked the "effect" of the operator on the basis: $$\frac{d}{dx}(x^0) + x \frac{d}{dx} (x^0) = 0 \\ \frac{d}{dx}(x^1) + x \frac{d}{dx} (x^1) = 1 + x \\ \frac{d}{dx}(x^2) + x \frac{d}{dx} (x^2) = 0 + 2x + 2x^2 \\ \frac{d}{dx}(x^3) + x \frac{d}{dx} (x^3) = 0 + 0 + 3x^2 + 3x^3 $$
From here I concluded that in 4-dimension the operator would be represented by the matrix: $$\left[ \begin {array}{cccc} 0&1&0&0\\ 0&1&2&0 \\ 0&0&2&3\\ {}0&0&0&3\end {array} \right] $$
but the correct seems to "exclude" the first column of zeros and instead the four dimension matrix is "a shift" to the left with the fourth column being: $[0,0,0,4]$. Where did I go wrong?
What you did looks fine to me, if you are using the basis $\{1,x,x^2,x^3\}$ for what you call $P^3$. (Are you certain that is the basis the book expects?)
Anywayno matter what the basis is supposed to be, the "shifted" answer you describe cannot be correct. It is nonsingular, but this operator annihilates nonzero constant functions.