Geometric Brownian motion
A geometric Brownian motion (GBM) (also known as exponential Brownian motion) is a continuous-time stochastic process in which the logarithm of the randomly varying quantity follows a Brownian motion (also called a Wiener process) with drift. It is an important example of stochastic processes satisfying a stochastic differential equation (SDE); in particular, it is used in mathematical finance to model stock prices in the Black–Scholes model. Technical definition: the SDE. A stochastic process "S" is said to follow a GBM if it satisfies the following stochastic differential equation (SDE): where formula_2 is a Wiener process  or Brownian motion, and formula_3 ('the percentage drift') and formula_4 ('the percentage volatility') are constants. The former is used to model deterministic trends, while the latter term is often used to model a set of unpredictable events occurring during this motion. Solving the SDE. For an arbitrary initial value "S" the above SDE has the analytic solution (under Itô's interpretation): The derivation requires the use of Itô calculus. Applying Itô's formula leads to where formula_7 is the quadratic variation of the SDE. When formula_9, formula_10 converges to 0 faster than formula_11, since formula_12. So the above infinitesimal can  be simplified by Plugging the value of formula_14 in the above equation and simplifying we obtain Taking the exponential and multiplying both sides by formula_16 gives the solution claimed above. Properties. The above solution formula_17 (for any value of t) is a log-normally distributed random variable with expected value and variance given by They can be derived using the fact that formula_20 is a martingale, and that The probability density function of formula_17 is: To derive the probability density function for GBM, we must use the Fokker-Planck equation to evaluate the time evolution of the PDF: where formula_25  is the Dirac delta function. To simplify the computation, we may introduce a logarithmic transform formula_26, leading to the form of GBM: Then the equivalent Fokker-Planck equation for the evolution of the PDF becomes: Define formula_29 and formula_30. By introducing the new variables formula_31 and formula_32, the derivatives in the Fokker-Planck equation may be transformed as: Leading to the new form of the Fokker-Planck equation: However, this is the canonical form of the heat equation. which has the solution given by the heat kernel: Plugging in the original variables leads to the PDF for GBM: When deriving  further properties of GBM, use can be made of the SDE of which GBM is the solution, or the explicit solution given above can be used. For example, consider the stochastic process log("S"). This is an interesting process, because in the Black–Scholes model it is related to the log return of the stock price. Using Itô's lemma with "f"("S") = log("S") gives It follows that formula_38. This result can also be derived by applying the logarithm to the explicit solution of GBM: Taking the expectation yields the same result as above: formula_40. Simulating sample paths. import numpy as  np import matplotlib.pyplot as plt mu = 1 n = 50 dt = 0.1 x0 = 100 np.random.seed(1) sigma = np.arange(0.8, 2, 0.2) x = np.exp( x = np.vstack([np.ones(len(sigma)), x]) x = x0 * x.cumprod(axis=0) plt.plot(x) plt.legend(np.round(sigma, 2)) plt.xlabel("$t$") plt.ylabel("$x$") plt.title( plt.show() Multivariate version. GBM can be extended to the case where there are multiple correlated price paths. Each price path follows the underlying process where the Wiener processes are correlated such that formula_42 where formula_43. For the multivariate case, this implies that Use in finance. Geometric Brownian motion is used to model stock prices in the Black–Scholes model and  is the most widely used model of stock price behavior. Some of the arguments for using GBM to model stock prices are: However, GBM is not a completely realistic model, in particular it falls short of reality in the following points: Extensions. In an attempt to make GBM more realistic as a model for stock prices, one can drop the assumption that the volatility (formula_45) is constant. If we assume that the volatility is a deterministic function of the stock price and time, this is called a local volatility model. If instead we assume that the volatility has a randomness  of its own—often described by a different equation driven by a different Brownian Motion—the model is called a stochastic volatility model.