### How to simulate stock prices with a Geometric Brownian Motion?

• I want to simulate stock price paths with different stochastic processes. I started with the famous geometric brownian motion. I simulated the values with the following formula:

$$R_i=\frac{S_{i+1}-S_i}{S_i}=\mu \Delta t + \sigma \varphi \sqrt{\Delta t}$$

with:

$\mu=$ sample mean

$\sigma=$ sample volatility

$\Delta t =$ 1 (1 day)

$\varphi=$ normally distributed random number

I used a short way of simulating: Simulate normally distributed random numbers with sample mean and sample standard deviation.

Multiplicate this with the stock price, this gives the price increment.

Calculate Sum of price increment and stock price and this gives the simulated stock price value. (This methodology can be found here)

So I thought I understood this, but now I found the following formula, which is also the geometric brownian motion:

$$S_t = S_0 \exp\left[\left(\mu - \frac{\sigma^2}{2}\right) t + \sigma W_t \right]$$

I do not understand the difference? What does the second formula says in comparison to the first? Should I have taken the second one? How should I simulate with the second formula?

This question is **really** close to be off-topic, but it can be interesting for later users so I'll still answer it.

@SRKX, by the way, why would this question be close to be off-topic? I find it more on target than 30%-40% of all other questions recently asked. You will be surprised how many market practitioners cannot answer this seemingly simple question, even those on the derivatives and exotics side.

@Freddy well GBM is the most basic process used in Quant finance. If you don't know it's closed and discrete form, it's unlikely you are a professional *quant* (you might be a trader, or something else...) which is the target niche of users. But I still answered it, because it can be useful and then we can close other questions related to the topic and refer to this one.

Please do not hesitate to register in order to help the site grow and make it out of beta!

@SRKX, I hear where you are coming from, its just then maybe my hinted 30-40% questions do not qualify either? I see tons of "whats the best data feed for xyz" questions passing the "filter". Just wanted to understand how questions are screened

@SRKX, whats the benefit to the user to register (thought I registered with having an account). As you can see I have not asked a single question here, but only tried to answer questions. (I quench my thirst on Stackoverflow in terms of asking questions ;-)

@Freddy we try our best to close the one we find off-topic, maybe some of them went through. About registration, I was talking to the user who wrote the question, and it helps in the Area51 stats for make it out of beta.

@ Freddy mh, I am not a professional quant, I am studying msc statistics and want to work in financial industry, but my lectures in this topic at university really sucks, they do not explain anything and just kicking formulars, that's why I try to understand what the formula is really doing and the difference.....no, I did not do math before......

see if you can get your hands on a copy of Glasserman's book Monte Carlo Methods in Financial Engineering, truly a masterpiece in many regards.

• SRKX Correct answer

9 years ago

The way you do it in the first place is a discretization of the Geometric Brownian Motion (GBM) process. This method is most useful when you want to compute the path between $S_0$ and $S_t$, i.e. you want to know all the intermediary points $S_i$ for $0 \leq i \leq t$.

The second equation is a closed form solution for the GBM given $S_0$. A simple mathematical proof showed that, if you know the initial point $S_0$ (which is $a$ in your equation), then the value of the process at time $t$ is given by your equation (which contains $W_t$, so $S_t$ is still random). However, this method will not tell you anything about the path.

As mentioned in the comments below, you can also use the close form to simulate each step of the paths.

nice concise explanation. Upvoted

There is no reason at all that paths cannot be simulated using the second method. Solving the SDE over a single interval will still allow a conditional formula such as $S_t = S_{t-1} \exp \{ (\mu - \sigma^2/2)\Delta t + \sigma (W_t - W_{t-1})\}$ with the standard method of simulation for the sample path of the brownian motion.

@user25064 this is not what I meant, you can indeed do these multiple steps with the closed form. I meant that if you use it to compute $S_T$ directly, then you don't know what happened until then. There was no judgement here.

solving closed form might get you boost on parallel system once you are not dependent on St-1 anymore