I have got this interview question twice. Does anyone know from which interview question book or another source this question comes from? It may be some well known source as two different interviewers asked the same question, but unfortunately I don't know the source.

Here is what I did during the interviews:

Apply Itô to $f(W)=W\exp(W)$

$\frac{\partial f}{\partial W}=\exp(W)+W \exp(W)$

$\frac{\partial^2 f}{\partial W^2}=2\exp(W)+W \exp(W)$

$df=(\exp(W)+W \exp(W))dW + (\exp(W)+1/2 W \exp(W)) dt$

Given that we will compute the expected value, we ignore the stochastic integral term:

$df= (\exp(W)+1/2f) dt$

  • $\begingroup$ I see that interviews aren't getting any easier... $\endgroup$ Aug 16, 2021 at 7:55
  • 3
    $\begingroup$ ..or more relevant to the job $\endgroup$
    – Arshdeep
    Aug 16, 2021 at 18:34

5 Answers 5


Hereunder is how I would solve that. I would say this is some sort recurring exercice in probability classes at university.

Solution based on the derivation of the characteristic function $e^{\lambda W_T}$, as $W_T$ is a gaussian random variable of mean 0 and standard deviation $\sqrt{T}$. Then, $E[e^{\lambda W_T}] = e^{\lambda^2 \times T/2}$

Deriving the rhs expression once in $\lambda$ gives $2\lambda\frac{T}{2} \times e^{\lambda^2 \frac{T}{2}} $.

Finally, observing that $E[W_T e^{W_T}]$ corresponds to the derivation of $E[e^{\lambda W_T}]$ evaluated in $\lambda=1$, we can conclude that $E[W_T e^{W_T}] = Te^{T/2}$

  • 2
    $\begingroup$ I like those derivation under summation / integration tricks very much, eg wenn calculating various integer sums or such. Your ‘trick‘ somehow eluded me til today. +1! $\endgroup$ Aug 14, 2021 at 17:11
  • 2
    $\begingroup$ Nice. Richard Feynman apparently likes these type of tricks where you differentiate wrt a parameter evaluated at 1 or 0. $\endgroup$
    – user34971
    Aug 15, 2021 at 7:38
  • $\begingroup$ Very nice solution!! $\endgroup$ Aug 15, 2021 at 9:20

Notice that $$e^{W^{Q}(T)}$$ looks almost like Doleans exponential $$e^{W^{Q}(T)-\frac{1}{2}T}$$ Therefore $$E^Q[W^{Q}(T)e^{W^{Q}(T)}]=E^Q[W^{Q}(T)e^{W^{Q}(T)}]e^{-\frac{1}{2}T}e^{+\frac{1}{2}T}$$ $$=E^Q[W^{Q}(T)e^{W^{Q}(T)-\frac{1}{2}T}]e^{\frac{1}{2}T}$$ We now define new probability measure $\bar{Q}$ via the Radon Nikodym derivative: $$\frac{{d\bar{Q}}}{dQ}=e^{W(T)-\frac{1}{2}T}$$ Under $\bar{Q}$ measure $$W^{\bar{Q}}(t)=W^{Q}(t)-t$$ is brownian motion. Therefore: $$E^Q[W^{Q}(T)e^{W^{Q}(T)-\frac{1}{2}T}]e^{\frac{1}{2}T}=E^{\bar{Q}}[W^{\bar{Q}}(T)+T]e^{\frac{1}{2}T}=Te^{\frac{1}{2}T}$$

  • 1
    $\begingroup$ Having re-read all answers, this one is my personal favourite. Dare I say the most elegant? Prob easiest to compute, if one remembers Girsanov's theorem well. $\endgroup$ Aug 18, 2021 at 11:50

To continue your thought:

$$f(x)=x{\rm e}^x $$

$$df(W_t) = \left({\rm e}^{W_t} + f(W_t)\right) dW_t + \left({\rm e}^{W_t} + 1/2f(W_t) \right)dt $$

We now integrate from $0$ to $T$ ($W_0=0$):

$$f(W_T) = \int_0^T \left({\rm e}^{W_t} + f(W_t) \right) dW_t + \int_0^T {\rm e}^{W_t} dt + 1/2 \int_0^T f(W_t) dt. $$

Then take expectations on both sides and obtain (commuting integration and expectation for the time integrals):

$$E\left[f(W_T)\right] = \int_0^T {\rm e}^{t/2} dt + 1/2 \int_0^T E\left[ f(W_t)\right] dt $$

Introducing deterministic function:

$$ y(u) := E\left[f(W_u)\right], $$

we get

$$ y(T) = \int_0^T {\rm e}^{t/2} dt + 1/2 \int_0^T y(t) dt. $$

Taking the derivative wrt $T$ on both sides, gives ODE:

$$ y'(T) = {\rm e}^{T/2} + 1/2 y(T), $$

$$y(0) = 0,$$

with solution:

$$y(T) = T{\rm e}^{T/2}.$$


So let‘s add the brute force solution as well:

$W_T\sim N(0,T)$ so

$$ \begin{align} E\left(W_Te^{W_T}\right)&=\int_{-\infty}^{\infty}xe^x\frac{e^{-\frac{x^2}{2T}}}{\sqrt{2\pi T}}dx\\ &= \int_{-\infty}^{\infty}x\frac{e^{-\frac{x^2-2Tx}{2T}}}{\sqrt{2\pi T}}dx \\ &= \int_{-\infty}^{\infty}x\frac{e^{-\frac{x^2-2Tx+T^2-T^2}{2T}}}{\sqrt{2\pi T}}dx\\ &= e^{1/2T}\int_{-\infty}^{\infty}x\frac{e^{-\frac{1}{2}\left(\frac{x-T}{\sqrt{T}}\right)^2}}{\sqrt{2\pi T}}dx \end{align} $$

Now let $z=(x-T)/\sqrt{T}$ and $x=T+z\sqrt{T}$ and $dx=dz\sqrt{T}$ then

$$ \begin{align} E\left(W_Te^{W_T}\right)&=e^{1/2T}\int_{-\infty}^{\infty}x\frac{e^{-\frac{1}{2}\left(\frac{x-T}{\sqrt{T}}\right)^2}}{\sqrt{2\pi T}}dx\\&= e^{1/2T}\int_{-\infty}^{\infty}(T+\sqrt{T}z)\frac{e^{-\frac{1}{2}\left(z\right)^2}}{\sqrt{2\pi}}dz\\ &=Te^{\frac{1}{2}T} \end{align} $$

  • 1
    $\begingroup$ +1 Just what the interviewer would have liked most. :) That completion to square and that integration of odd functions never fail. $\endgroup$
    – ir7
    Aug 16, 2021 at 16:41

There are many roads to Rome. Here is the road of overkill, but which nevertheless gives a glimpse of the uses of Malliavin calculus:

Note that $$ E_0 \left[W(T) e^{W(T)} \right] = E_0 \left[e^{W(T)} \int_0^T dW(t) \right] $$ The integration by parts formula of Malliavin calculus reads $$ E_0 \left[ F \int_0^T h(t)dW(t) \right] = E_0 \left[ \int_0^T (D^W_t F) h(t) dt \right] $$ where $D_t^W$ denotes the Malliavin derivative with respect to $W$.

In this problem $F = e^{W(T)}$ and $h(t) = 1$. Furthermore, $$ D^W_t e^{W(T)} = 1_{[0,T]} (t) e^{W(T)} $$ with $1_{[0,T]}(t) = 1$ if $t \in [0,T]$ and $0$ otherwise.

Hence, \begin{align} E_0 \left[ \int_0^T (D^W_t F) h(t) dt \right] &= E_0 \left[ \int_0^T e^{W(T)} dt \right] \\ &= T E_0 \left[e^{W(T)} \right] \\ &= T e^{T/2} \end{align}

  • 1
    $\begingroup$ This would be a most entertaining way to answer the question as there is a high probability that the interviewer will have no idea how Malliavin calculus works. $\endgroup$ Aug 19, 2021 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.