European Vanilla Option Pricing – Black-Scholes PDE

Assume underlying spot follows Geometric Brownian Motion, i.e.

    \[dS = \mu Sdt + \sigma SdW_{t}\]

Let C be the call option price. We obtain dC using Ito Lemma

    \[dC = [\frac{\partial C}{\partial t} + \frac{\partial C}{\partial S}\mu S + \frac{1}{2}\frac{\partial ^{2} C}{\partial S^{2}}\sigma ^{2}S^{2}]dt + \frac{\partial C}{\partial S}\sigma Sdz\]

Construct a delta neutral portfolio (short call option and long underlying), then we have:

    \[dV = \frac{\partial C}{\partial S}dS - dC\]

If we combine the terms, we will get

    \[dV = [-\frac{\partial C}{\partial t} - \frac{1}{2}\frac{\partial ^{2}C}{\partial S^{2}} \sigma ^{2}S^{2}]dt\]

Realise dV is independent of random term dz, thus portfolio V is risk free.
Realise dV is independent of expected return \mu.

Thus, portfolio V should earn the risk free rate of return, i.e.

    \[dV = rVdt = r(\frac{\partial C}{\partial S}S - C)dt\]

Therefore, combining with dV in the previous step, we have below Black-Scholes PDE:

    \[\frac{\partial C}{\partial t} + \frac{1}{2}\frac{\partial ^{2}C}{\partial S^{2}}\sigma ^{2}S^{2} + \frac{\partial C}{\partial S}rS = rC\]

Now we need to solve the above Black-Scholes PDE.

Step 1

Transformation: Let’s introduce new variables x = \ln{\frac{S}{K}}, and \tau = T-t.

Therefore, the Call option price C(S, t) can be represented using new variables x and \tau as C(Ke^{x}, T-\tau).

Now we introduce a new function Z(x, \tau) = C(Ke^{x}, T-\tau). We need to find the PDE for Z(x, \tau) where x \in \mathbb{R}, \tau \in [0, T]

By Chain rule for partial derivatives, we have:

    \[\frac{\partial C}{\partial S} = \frac{\partial Z}{\partial x} \frac{\partial x}{\partial S} + \frac{\partial Z}{\partial \tau} \frac{\partial \tau}{\partial S}=\frac{\partial Z}{\partial x} \frac{K}{S} \frac{1}{K}=\frac{\partial Z}{\partial x} \frac{1}{S}\]

    \[\frac{\partial ^{2} C}{\partial S^{2}} = \frac{\partial (\frac{\partial Z}{\partial x} \frac{1}{S})}{\partial S} = \frac{\partial (\frac{\partial Z}{\partial x}) \frac{1}{S}}{\partial S} + \frac{\frac{\partial Z}{\partial x} \partial (\frac{1}{S})}{\partial S} \]

    \[= [\frac{\partial (\frac{\partial Z}{\partial x})}{\partial x} \frac{\partial x}{\partial S} + \frac{\partial (\frac{\partial Z}{\partial x})}{\partial \tau} \frac{\partial \tau}{\partial S}] \frac{1}{S} + \frac{\partial Z}{\partial x}(-\frac{1}{S^{2}}) = \frac{\partial ^{2}Z}{\partial x^{2}} \frac{1}{S^{2}} - \frac{\partial Z}{\partial x} \frac{1}{S^{2}}\]

    \[\frac{\partial C}{\partial t} = \frac{\partial C}{\partial \tau}\frac{\partial \tau}{\partial t} + \frac{\partial Z}{\partial x} \frac{\partial x}{\partial t} = - \frac{\partial Z}{\partial \tau}\]

Now we plug \frac{\partial C}{\partial S}, \frac{\partial ^{2} C}{\partial S^{2}}, \frac{\partial C}{\partial t}, Z into the Black-Scholes PDE, then we find the PDE for Z(x, \tau):

    \[\frac{\sigma ^{2}}{2} \frac{\partial ^{2} Z}{\partial x^{2}} + (r-\frac{\sigma ^{2}}{2})\frac{\partial Z}{\partial x} -\frac{\partial Z}{\partial \tau} - Zr = 0\]

Step 2

Transformation to Heat Equation: Let’s introduce a new function u(x, \tau) = e^{\alpha x + \beta \tau}Z(x,\tau). We need to choose constants \alpha, \beta \in \mathbb{R} so that the PDE of u is Heat Equation.

    \[\frac{\partial u}{\partial \tau} = \beta e^{\alpha x + \beta \tau} Z + e^{\alpha x + \beta \tau}\frac{\partial Z}{\partial \tau} \]

    \[\frac{\partial u}{\partial x} = \alpha e^{\alpha x + \beta \tau} Z + e^{\alpha x + \beta \tau}\frac{\partial Z}{\partial x} \]

    \[\frac{\partial ^{2}u}{\partial x^{2}} = \alpha ^{2} e^{\alpha x + \beta \tau}Z +\alpha e^{\alpha x + \beta \tau} \frac{\partial Z}{\partial x} + \alpha e^{\alpha x + \beta \tau} \frac{\partial Z}{\partial x} + e^{\alpha x + \beta \tau} \frac{\partial ^{2}Z}{\partial x^{2}} \]

    \[= e^{\alpha x + \beta \tau}\frac{\partial ^{2} Z}{\partial x^{2}} + 2\alpha e^{\alpha x + \beta \tau}\frac{\partial Z}{\partial x} + \alpha ^{2}e^{\alpha x + \beta \tau}Z \]

Together with the PDE for Z, we can derive the PDE for u:

    \[\frac{\partial u}{\partial \tau} -\frac{\sigma ^{2}}{2}\frac{\partial ^{2}u}{\partial x^{2}} + (\alpha \sigma ^{2} + \frac{\sigma ^{2}}{2} - r)\frac{\partial u}{\partial x} + (r + r\alpha -\frac{\sigma ^{2} \alpha ^{2}}{2} - \frac{\alpha \sigma ^{2}}{2})u = 0\]

To be a Heat Equation, we need to force the last two terms be 0. Thus

    \[\alpha \sigma ^{2} + \frac{\sigma ^{2}}{2} - r = 0\]

    \[r + r\alpha -\frac{\sigma ^{2} \alpha ^{2}}{2} - \frac{\alpha \sigma ^{2}}{2} = 0\]

Then we have

    \[\alpha = \frac{r}{\sigma ^{2}} - \frac{1}{2}\]

    \[\beta = \frac{r}{2} + \frac{\sigma ^{2}}{8} + \frac{r^{2}}{2\sigma ^{2}}\]

Step 3

The solution u(x, \tau) of PDE \frac{\partial u}{\partial \tau} -\frac{\sigma ^{2}}{2}\frac{\partial ^{2}u}{\partial x^{2}} = 0 is given by Green formula as below:

    \[u(x, \tau) = \frac{1}{\sqrt{2\sigma ^{2}\pi \tau}} \int _{-\infty}^{\infty} e^{-\frac{(x-s)^{2}}{2\sigma ^{2} \tau}}u(s, 0) ds \]

Step 4

We look at the boundary condition u(x, 0).

    \[u(x, 0) = e^{\alpha x}Z(x, 0) = e^{\alpha x}C(S, T) =  e^{\alpha x}(S-K) \,if \,x>0\]

    \[u(x, 0) = 0 \,if \,x \leq 0\]


    \[u(x, \tau) = \frac{1}{\sqrt{2\sigma ^{2}\pi \tau}} \int _{0}^{\infty} e^{-\frac{(x-s)^{2}}{2\sigma ^{2} \tau}}e^{\alpha s}(S-K) ds \]

which can be integrated as below, where \phi is the cumulative distribution function (CDF) for Normal distribution.

    \[u(x, \tau)=Se^{\alpha x + \beta \tau} \phi (\frac{x+(r+\frac{\sigma ^{2}}{2})\tau}{\sigma \sqrt{\tau}}) - Ke^{\alpha x + \frac{1}{2}\sigma ^{2}\tau \alpha ^{2}} \phi (\frac{x+\sigma ^{2}\tau \alpha}{\sigma \sqrt{\tau}}) \]

Step 5

From the above steps, we have relation

    \[u(x, \tau) = e^{\alpha x + \beta \tau}Z(x,\tau) = e^{\alpha x + \beta \tau}C(Ke^{x}, T-\tau) = e^{\alpha x + \beta \tau}C(S, t)\]

And from Step 4, we know the result of u(x, \tau).

Therefore, we derive C(S, t) as

    \[C(S, t) = S\phi (\frac{x+(r+\frac{\sigma ^{2}}{2})\tau}{\sigma \sqrt{\tau}}) - Ke^{\frac{1}{2}\sigma ^{2}\tau \alpha ^{2}-\beta \tau} \phi (\frac{x+\sigma ^{2}\tau \alpha}{\sigma \sqrt{\tau}}) \]

Now we plug in x, \tau, \alpha, \beta from previous steps. Finally, Call option price C(S, t) can be represented as

    \[C(S, t) = S\phi (d_{1}) - e^{-r(T-t)}K\phi (d_{2})\]


    \[d_{1} = \frac{\ln \frac{S}{K} + (r+\frac{\sigma ^{2}}{2})(T-t)}{\sigma \sqrt{T-t}} \]

    \[d_{2} = d_{1} - \sigma \sqrt{T-t} = \frac{\ln \frac{S}{K} + (r-\frac{\sigma ^{2}}{2})(T-t)}{\sigma \sqrt{T-t}}\]


Python implementation of Black-Scholes formula:

def ncdf(x):
    Cumulative distribution function for the standard normal distribution.
    Alternatively, we can use below:
    from scipy.stats import norm
    return (1.0 + math.erf(x / math.sqrt(2.0))) / 2.0
def npdf(x):
    Probability distribution function for the standard normal distribution.
    Alternatively, we can use below:
    from scipy.stats import norm
    return np.exp(-np.square(x) / 2) / np.sqrt(2 * np.pi)
def blackScholesOptionPrice(callPut, spot, strike, tenor, rate, sigma):
    Black-Scholes option pricing
    tenor is float in years. e.g. tenor for 6 month is 0.5
    d1 = (np.log(spot / strike) + (rate + 0.5 * sigma ** 2) * tenor) / (sigma * np.sqrt(tenor))
    d2 = d1 - sigma * np.sqrt(tenor)
    if callPut == 'Call':
        return spot * ncdf(d1) - strike * np.exp(-rate * tenor) * ncdf(d2)
    elif callPut == 'Put':
        return -spot * ncdf(-d1) + strike * np.exp(-rate * tenor) * ncdf(-d2)
def blackScholesVega(callPut, spot, strike, tenor, rate, sigma):
    """ Black-Scholes vega """
    d1 = (np.log(spot / strike) + (rate + 0.5 * sigma ** 2) * tenor) / (sigma * np.sqrt(tenor))
    return spot * np.sqrt(tenor) * npdf(d1)
def blackScholesDelta(callPut, spot, strike, tenor, rate, sigma):
    """ Black-Scholes delta """
    d1 = (np.log(spot / strike) + (rate + 0.5 * sigma ** 2) * tenor) / (sigma * np.sqrt(tenor))
    if callPut == 'Call':
        return ncdf(d1)
    elif callPut == 'Put':
        return ncdf(d1) - 1
def blackScholesGamma(callPut, spot, strike, tenor, rate, sigma):
    """" Black-Scholes gamma """
    d1 = (np.log(spot / strike) + (rate + 0.5 * sigma ** 2) * tenor) / (sigma * np.sqrt(tenor))
    return npdf(d1) / (spot * sigma * np.sqrt(tenor))

44 thoughts on “European Vanilla Option Pricing – Black-Scholes PDE”

  1. Hi there, I do think your website may be having browser compatibility issues. Whenever I take a look at your site in Safari, it looks fine however when opening in Internet Explorer, it’s got some overlapping issues. I just wanted to provide you with a quick heads up! Apart from that, wonderful website!|

  2. Hello, i feel that i saw you visited my website thus i came to go back the choose?.I am trying to find things to improve my web site!I suppose its ok to make use of some of your concepts!!|

  3. I seriously love your website.. Very nice colors & theme. Did you create this site yourself? Please reply back as I’m hoping to create my very own site and would like to know where you got this from or what the theme is called. Many thanks!|

  4. Thanks for one’s marvelous posting! I seriously enjoyed reading it, you happen to be a great author.I will always bookmark your blog and definitely will come back someday. I want to encourage you continue your great job, have a nice day!|

  5. You are so cool! I don’t believe I’ve truly read a single thing like this before. So good to find somebody with genuine thoughts on this subject matter. Really.. thanks for starting this up. This website is something that is required on the web, someone with some originality!|

  6. Hiya, I’m really glad I have found this info. Today bloggers publish only about gossips and net and this is actually annoying. A good web site with interesting content, that’s what I need. Thanks for keeping this web-site, I will be visiting it. Do you do newsletters? Cant find it.

  7. I don’t even know how I ended up here, but I thought this post was great. I don’t know who you are but definitely you are going to a famous blogger if you aren’t already 😉 Cheers!|

  8. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but instead of that, this is fantastic blog. A fantastic read. I’ll definitely be back.|

  9. You’re so awesome! I don’t believe I’ve read through something like that before. So great to discover someone with some unique thoughts on this issue. Seriously.. thanks for starting this up. This site is one thing that is needed on the internet, someone with a little originality!|

  10. What’s up, yup this article is really fastidious and I have learned lot of things from it concerning blogging. thanks.|

  11. I’d like to thank you for the efforts you’ve put in penning this site. I am hoping to view the same high-grade blog posts from you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal site now ;)|

  12. Have you ever thought about writing an ebook or guest authoring on other websites?
    I have a blog based on the same subjects you
    discuss and would really like to have you share some stories/information. I know my readers would
    enjoy your work. If you are even remotely interested, feel free to send me an e mail.

  13. Howdy! Someone in my Facebook group shared this website with us so I came to take a look. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Great blog and superb design and style.|

  14. Hello there, just became alert to your blog through Google, and found that it is really informative. I’m going to watch out for brussels. I’ll appreciate if you continue this in future. Lots of people will be benefited from your writing. Cheers!|

  15. Attractive part of content. I just stumbled upon your web site and in accession capital to say that I get in fact enjoyed account your blog posts. Any way I’ll be subscribing for your augment or even I success you get right of entry to consistently fast.|

  16. Hey would you mind sharing which blog platform you’re using? I’m going to start my own blog in the near future but I’m having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something completely unique. P.S Apologies for getting off-topic but I had to ask!|

  17. hi!,I like your writing so much! share we keep up a correspondence extra about your article on AOL? I need an expert in this space to unravel my problem. Maybe that’s you! Looking forward to see you. |

  18. Wow! This can be one of the most helpful blogs we’ve ever come across on thesubject. Basically fantastic info! I am also a specialist in this topic therefore I can understand your effort.

  19. I wanted to type a quick word in order to express gratitude to you for all the pleasant tricks you are showing here. My extended internet look up has finally been compensated with high-quality knowledge to write about with my friends and classmates. I would assert that we site visitors are undeniably fortunate to exist in a really good site with many brilliant individuals with useful suggestions. I feel extremely blessed to have discovered your web site and look forward to tons of more exciting moments reading here. Thanks once again for all the details.

  20. I precisely had to thank you so much again. I’m not certain the things that I would’ve sorted out in the absence of the ways documented by you on this area of interest. This was a frustrating matter in my position, however , taking a look at the specialized technique you managed it took me to leap over contentment. I am just grateful for your help and then hope you comprehend what a powerful job you happen to be getting into educating many people via your blog. I am certain you’ve never come across any of us.

  21. My husband and i felt lucky when John managed to finish up his survey from the ideas he got while using the web pages. It is now and again perplexing to just choose to be offering guidance people today have been trying to sell. And we already know we have the blog owner to be grateful to because of that. All of the illustrations you made, the straightforward blog menu, the friendships you can aid to foster – it is mostly terrific, and it’s leading our son in addition to the family understand that content is pleasurable, which is particularly indispensable. Thank you for the whole thing!

  22. My wife and i felt really excited that Edward could complete his studies using the precious recommendations he made using your web page. It’s not at all simplistic just to continually be giving away tricks many people have been making money from. And now we know we’ve got the website owner to appreciate because of that. All of the explanations you made, the easy blog navigation, the friendships you can help create – it’s got most powerful, and it is making our son and the family feel that the concept is cool, and that’s really important. Many thanks for the whole thing!

  23. Thank you a lot for providing individuals with an extremely spectacular possiblity to read articles and blog posts from this site. It’s usually very pleasurable and stuffed with amusement for me and my office friends to search your website a minimum of three times per week to read through the fresh guides you will have. And definitely, I’m so always happy with all the splendid tactics you serve. Certain 1 points in this article are without a doubt the simplest I’ve ever had.

Leave a Reply

Your email address will not be published.