Is Gaussian a possible waveform for particle in a box? I know a free particle can have gaussian waveform but can a particle in an infinite well have a similar wavefunction, I believe no as gaussian can not be broken into series of sines and cosines, but gaussians only.
Does that mean only some specific waveforms are allowed for a trapped particle (keeping continuity  and differentiability in mind).
 A: Intuitively, letting $L$ be the size of your box, you recover space when $L\to\infty$. It is could seem therefore feasible to construct for all $L$ an analogous function that converges to the Gaussian as $L\to\infty$.
There is a natural way to do this. Say your box is the domain $[0,L]$ and you want to approximate the Gaussian placed at location $a$ in the large $L$ limit. I normalised the width, so $L$ is rather the ratio of the box length to the Gaussian's width:
$$
\psi(x) = e^{-(x-a)^2/2}
$$
You can "fit" it into the box using the method of images. Mathematically, you can set the new state:
$$
\psi_L(x) = \sum_{n\in\mathbb Z}e^{-(x-2Ln-a)^2/2}-e^{-(-x-2Ln-a)^2/2}
$$
You can check that $\psi_L\to\psi$ in the $L\to\infty$ limit.
To touch back on your remark on sum of trig functions, you can rewrite the function in any basis you want. the natural one is to expand it into the free particle in a box energy eigenstates:
$$
\psi_L(x) = \frac{2}{L}\sum_{n=1}^\infty \sqrt{2\pi}e^{-k_n^2/2}\sin(k_na)\sin(k_nx) \\
k_n = \frac{\pi n}{L}
$$
You can get this by directly projecting. A more insightful way to relate it to the first formula is to use the Poisson summation formula. Equivalently, you can notice that periodising spatially amounts to sampling the Fourier transform (modulo the alternating sign for your boundary condition).
This actually leads to a more general scheme for any initial function $\psi$ to approximate. Just define:
$$
\psi_L(x) = \sum_{n\in\mathbb Z} \psi(x-2Ln)-\psi(-x-2Ln)
$$
which you can also rewrite using $\phi$ the Fourier transform of $\psi$:
$$
\phi(k) = \int dx e^{-ikx}\psi(x) \\
\psi_L(x) = \frac{2}{L}\sum_{n=1}^\infty \frac{\phi(k_n)-\phi(-k_n)}{2i}\sin(k_nx) 
$$
Hope this helps
