The problem is:
Solve the P.D.E. $U_t=U_{xx}$ with the following initial and boundary conditions: $$U(0,t)=U(\pi,t)=0,\quad\text{and}\quad U(x,0)=u_0-u_0\sin x$$
For the given fixed boundary conditions, I solved the equation for $U(x,0)=u_0$ and got $U_1(x,t)$, then solved it for $U(x,0)=-u_0\sin x$ and got $U_2(x,t)$ as the solution. Now I correctly got $U(x,t)=U_1(x,t)+U_2(x,t)$ as the solution to the original P.D.E..
Given that this technique worked for this problem, I wonder if I am allowed to do this when solving other P.D.E.s and whether it is a known method (for instance be known as the principle of superpositions).