# How to take the expectation of an exponential martingale? And an exponential with a random value?

I am reading Shreve's Stochastic Calculus for Finance II. He states on pages 110 and 111 that,

$$E[exp(\sigma m-\frac{1}{2}\sigma^2 \tau_m)] = 1$$ $$E[exp(-\frac{1}{2}\sigma^2 \tau_m)] = e^{-\sigma m}$$

I understand that the top equation is a martingale and should thus have a constant expectation but I don't understand why both equations are true. I tried taking the expectations of both equations by taking the integral from 0 to $$m$$, but that doesn't work since I get

$$E[exp(-\frac{1}{2}\sigma^2 \tau_m)] = \int_0^m exp(-\frac{1}{2}\sigma^2 \tau_m) dt = \frac{2-2exp{(-\frac{ms^2}{2}})}{s^2} \color{red} \ne e^{\sigma m}$$

How do I prove in detail both expectations?

Here are the pages for reference.

Given that $$exp(\sigma m-\frac{1}{2}\sigma^2 \tau_m)$$ is a martingale, you just need to substitute $$m = 0$$ into it to find the value of its expectation, as for any martingale $$Z_t$$ we have that $$E[Z_t] = Z_0$$.
If you are really interested in an algebric proof, you need to find first the distribution of $$\tau_m$$. You can find it on the link below or you can try to prove it by yourself.