By definition, a logarithm is the inverse of an exponential. So logarithms undo exponentials and exponentials undo logarithms.

In other words:

If \(\displaystyle y = a^x\) then \(\displaystyle \log_a{y} = x\) where \(\displaystyle a\) is any base.

Proof: \(\displaystyle y = a^x\)

\(\displaystyle \log_a{y} = \log_a{a^x}\)

\(\displaystyle \log_a{y} = x\) (since logarithms undo exponentials).

Similarly:

If \(\displaystyle y = \log_a{x}\) then \(\displaystyle a^y = x\) where \(\displaystyle a\) is any base.

Proof: \(\displaystyle y = \log_a{x}\)

\(\displaystyle a^y = a^{\log_a{x}}\)

\(\displaystyle a^y = x\) (since exponentials undo logarithms).

Now, looking at your question.

\(\displaystyle z = e^{\frac{x^2}{2}}\).

In this case our base is the number \(\displaystyle e\), Euler's Number. It pops up so often that you should research it...

We want to undo the exponential, so we use a logarithm of base \(\displaystyle e\).

\(\displaystyle z = e^{\frac{x^2}{2}}\)

\(\displaystyle \log_e{z} = \log_e{e^{\frac{x^2}{2}}}\)

\(\displaystyle \log_e{z} = \frac{x^2}{2}\) since the logarithm undoes the exponential

\(\displaystyle 2\log_e{z} = x^2\)

\(\displaystyle x = \pm\sqrt{2\log_e{z}}\).

Note: Since the logarithm of base \(\displaystyle e\) occurs so often in nature, it is called the Natural Logarithm, and is often denoted as \(\displaystyle \ln\).

So it may be that the answer is written as

\(\displaystyle x = \pm\sqrt{2\ln{z}}\).