Tail Value at Risk of Normal Distribution For a random variable $X$, Tail-value-at-risk is denoted as $\operatorname{TVaR}_p(X) = \operatorname E(X \mid X>\pi_p) = \dfrac{ \int_{\pi_p}^\infty xf(x) \, dx}{1-F(\pi_p)}$, where $\pi_p=\operatorname{VaR}_p=$ the value-at-risk $=$ the value such that $P(X>\pi_p)=1-p$.
While I was reading through my book, I stumbled upon this page:

But I struggle to see how the second result was proved.  I'm either not sure how to do the calculus or I don't know what tricks they used to get there, but I can't figure it out.  Do you understand how they got there?
 A: First Part
Since $P(X > \pi_p) = 1 - p$ we have $P[(X - \mu)/\sigma > (\pi_p - \mu)/\sigma] = 1 - p.$
Since $Z = (X - \mu)/\sigma \sim N(0,1)$, the standard normal distribution function $\Phi$ specifies $\Phi(z) = P(Z \leqslant z)$ and $1 - \Phi(z) = P(Z > z).$
Thus,
$$P[(X - \mu)/\sigma > (\pi_p - \mu)/\sigma] = 1 - p \\ \implies 1- \Phi[(\pi_p - \mu)/\sigma] = 1 - p \\ \implies \Phi[(\pi_p - \mu)/\sigma] = p\\ \implies (\pi_p - \mu)/\sigma = \Phi^{-1}(p)\\ \implies \text{VaR}_p(X) =\pi_p = \mu + \sigma \Phi^{-1}(p)$$
Second Part
Note that
$$\int_{\pi_p}^\infty x f(x) \, dx= \int_{-\infty}^\infty x f(x) \, dx - \int_{-\infty}^{\pi_p} x f(x) \, dx  = \mu - \int_{-\infty}^{\pi_p} x f(x) \, dx.  $$
Changing variables with $x = \mu + \sigma z$ and  noting that $\phi(z)  = \sigma f(\mu + \sigma z)$ and $dx = \sigma dz$,  we have
$$\begin{align}\int_{-\infty}^{\pi_p} x f(x) \, dx &=  \int_{-\infty}^{(\pi_p - \mu)/\sigma}(\mu + \sigma z) \phi(z) \, dz \\ &= \mu \int_{-\infty}^{(\pi_p - \mu)/\sigma} \phi(z) \, dz  + \sigma \int_{-\infty}^{(\pi_p - \mu)/\sigma} z\phi(z) \, dz \\ &= \mu \Phi[(\pi_p - \mu)/\sigma] +  \sigma \int_{-\infty}^{(\pi_p - \mu)/\sigma} z\phi(z) \, dz \end{align}$$
As shown in the first part, $\Phi[(\pi_p - \mu)/\sigma] = p.$
The key here is the observation that the standard normal density function satisfies $z \phi(z) = -\phi'(z)$.
Hence,
$$\begin{align}\int_{\pi_p}^{\infty} x f(x) \, dx &= \mu - \mu p + \sigma \int_{-\infty}^{(\pi_p - \mu)/\sigma}\phi'(z) \, dz \\ &= \mu(1-p) + \sigma \phi[(\pi_p - \mu)/\sigma] \\ &= \mu(1-p) + \sigma \phi[\Phi^{-1}(p)],\end{align}  $$
and
$$\text{TVaR}_p(X) = \frac{\mu(1-p) + \sigma \phi[\Phi^{-1}(p)]  }{1 - F(\pi_p) } = \frac{\mu(1-p) + \sigma \phi[\Phi^{-1}(p)]  }{1 - p } \\ = \mu + \sigma \frac{\phi[\Phi^{-1}(p)]  }{1-p}$$
