General note:

Use fundamental theorem of calculus. The general statement is:

Here a(x) and b(x) represent functions of x.

However for Q function, you need not do all that.

Recall that where is the cdf of the standard gaussian distribution. Now by differentiating this we get:

But the differential of the cdf is the pdf ! Hence: