Any clue regarding this:
$$\int_0^\infty e^{-a^2x^2} \cos (bx) dx = \frac {\sqrt \pi}{2a}e^{\frac{-b^2}{4a^2}}$$
Any clue regarding this:
$$\int_0^\infty e^{-a^2x^2} \cos (bx) dx = \frac {\sqrt \pi}{2a}e^{\frac{-b^2}{4a^2}}$$
Let $$I(b) = \int^\infty_0 e^{-a^2 x^2} \cos (b x) \, dx, \quad a > 0.$$ Integrating by parts gives $$I(b) = \frac{2a^2}{b} \int^\infty_0 x e^{-a^2 x^2} \sin (bx) \, dx.$$
Also, differentiating $I(b)$ with respect to the parameter $b$ we have $$I'(b) = - \int^\infty_0 x e^{-a^2 x^2} \sin (bx) \, dx = - \frac{b}{2a^2} I(b).$$ Solving this first-order differential equation yields $$I(b) = K e^{-\frac{b^2}{4a^2}},$$ where $K$ is a constant to be determined. To find this constant, setting $b = 0$ one has $$I(0) = \int^\infty_0 e^{-(ax)^2} \, dx = \frac{\sqrt{\pi}}{2a} \cdot \frac{2}{\sqrt{\pi}} \int^\infty_0 e^{-u^2} \, du = \frac{\sqrt{\pi}}{2a} \cdot \text{erf} (\infty) = \frac{\sqrt{\pi}}{2a}.$$ So $K = \sqrt{\pi}/(2a)$ and we have $$I(b) = \int^\infty_0 e^{-a^2 x^2} \cos (b x) \, dx = \frac{\sqrt{\pi}}{2a} e^{-\frac{b^2}{4a^2}}, \quad a > 0,$$ as required.
Note that your solution is only valid for $a>0$. The more general result, valid for $a\in \mathbb{R}\setminus \{0\}$ is: $$\int_0^{\infty} e^{-a^2 x^2}\cos(bx)~dx=\frac{\sqrt{\pi}}{2\cdot \color{#AA0000}{|a|}}e^{-\frac{b^2}{4a^2}} \tag{1}$$
Substitute $u=ax$, then you obtain for $a>0$: $$\int_0^{\infty} e^{-a^2 x^2}\cos(bx)~dx=\frac{1}{a}\int_0^{\infty} e^{-u^2}\cos\left(\frac{b}{a}u\right)~du$$ And for $a<0$: $$\begin{align}\int_0^{\infty} e^{-a^2 x^2}\cos(bx)~dx&=\frac{1}{a}\int_0^{-\infty} e^{-u^2}\cos\left(\frac{b}{a}u\right)~du\\&=-\frac{1}{a}\int_{-\infty}^{0}e^{-u^2}\cos\left(\frac{b}{a}u\right)~du\\&=-\frac{1}{a}\int_{0}^{\infty}e^{-u^2}\cos\left(\frac{b}{a}u\right)~du \end{align}$$ Where on the last step we have made use of the fact that the integrand is even.
Note that the integral obviously diverges for $a=0$. Combining all the above results, we see that we have for $a\in \mathbb{R}\setminus \{0\}$: $$\int_0^{\infty} e^{-a^2 x^2}\cos(bx)~dx=\frac{1}{|a|}\int_0^{\infty} e^{-u^2}\cos\left(\frac{b}{a}u\right)~du \tag{2}$$
Then make use of the following question, which proves that for all $c\in \mathbb {R}$: $$\int_0^{\infty} e^{-x^2}\cos(cx)~dx=\frac{\sqrt{\pi}}{2}e^{-c^2/4}$$ You should obtain the result I have obtained on $(1)$.