When we have a linear partial differential equation, we can take any linear combination(superposition) of any of its solutions and it will be a solution by itself. My question is if the solutions that we are adding need to satisfy the same boundary conditions of the problem?
For example, if I am trying to solve the heat or diffusion equation with some wierd boundary conditions, can the whole solution be a linear combination of solutions with every solution satisfying a set of the original problem's boundary conditions?
The principle of superposition applies to linear homogeneous differential equations. In physical terms, this means that there are no external sources. For example, it applies to the equation $u_t-u_{xx}=0$, but not to the equation $u_t-u_{xx}=f(x,t)$. If $u$ and $v$ are solutions of the last equation, then $w=u+v$ satisfies the equation $w_t-w_{xx}=2\,f(x,t)$.
The same applies to the boundary conditions. If they are homogeneous, like $u(a,t)=0$, or $u_x(a,t)=0$, then the principle of superposition holds.