Newton-Raphson Method
We ditch bisection and let Newton-Raphson chase down implied volatility by hopping along tangent lines until it zeros in on the answer.
Some original drawings have corrections. Read the notes on those drawings alongside the worked steps.
So as I mentioned last time, I’m trying to find implied volatility, and I already took one swing at it with the bisection method. Now let’s go again โ this time with Newton-Raphson.
But before we touch any code, let’s figure out how Newton-Raphson actually sneaks up on a solution.
What’s the algorithm? How does it cook up an approximation?
Let’s walk through it.
How Newton-Raphson works
Here’s the idea.

Step one: pick any $x_1$ and plug it into the function.
(In practice you wouldn’t pick just anything. You’d pick something as close to the solution as you can guess. For efficiency, for economy, for not wasting your life, etc., etc.~)
Plug it in โ and oh god, $f(x_1)$ is huge. Way off. So $x_1$ is clearly not our solution.

So from the point $(x_1, f(x_1))$, draw the tangent line. Take the x-intercept of that tangent line and call it $x_2$. Plug $x_2$ back into $f(x)$.
Is $f(x_2)$ still ridiculously far from 0? Or are we getting close?

Still off? Cool. Draw the tangent line at $(x_2, f(x_2))$, take its x-intercept, call it $x_3$, judge again, and keep going~~~~ and going~~~~ and going~~~~
Done~
Honestly mind-blowing. And honestly โ kind of insane that someone thought of this in the first place.
OK now write it down
So we kinda get the vibe. Now we have to turn it into formulas, because the computer doesn’t speak English (or Korean, or whatever), it speaks math.
The computer is basically asking us:
“hey jerk โ
to
, what’s the rule? How do I get from one to the other??”
OK. The tangent line at the point
is:
![]()
Undeniable. Slope is $f'(x_n)$, line passes through
โ that’s literally just point-slope form.
And $x_{n+1}$ is the $x$ where this tangent line hits $y = 0$. Set $y = 0$, solve for $x$, and:

Boom. That’s the recurrence.
Easy!!!!
Let’s play
Let’s use this on our usual suspect:
![]()
(Why is it ALWAYS this one???? Because I already wrote the function for it last time^^ heh heh heh if you want a different example, you write it^^^^)
Ugh, but… we need a new function. Specifically, we need one for the derivative. Ughhhhhh ;_;
OK OK OK OK. The derivative of that thing is something an 11th grader can do in their sleep. Bang it out. Then on to the code.

This one’s the function we used for bisection last time~~

This one is just the derivative of it โ differentiated by hand and dropped into a function.

Easy, right? We literally just used the principle we walked through above:

That’s it. heh.
Now the actual implied vol part
OK, now using Newton-Raphson, let’s go extract the implied volatility of an option.
Wait hold on. Newton-Raphson needs $f(x)$ AND $f'(x)$, right? So before we sprint ahead, there’s something worth thinking about.

I drew option price as an increasing function of $\sigma$ โ is that actually right?
Yeah, it should be. For the vanilla calls and puts in this model, the payoff is convex, which is why a mean-preserving increase in dispersion raises value. Merely having a nonnegative payoff would not be enough. I mentioned this somewhere before โ over here , I think.
Anyway. What we want is the $\sigma$ at the intersection point over there. That is:
$$\text{BS\_formula}(\sigma) - \text{market price} = 0$$Let’s call the left side $f(\sigma)$:
$$f(\sigma) = \text{BS\_formula}(\sigma) - \text{market price}$$We want $f(\sigma) = 0$. And the derivative we need for Newton-Raphson is $f'(\sigma)$:
$$f'(\sigma) = \text{BS\_formula}'(\sigma) - 0$$The market price is a constant, so its derivative with respect to $\sigma$ is 0.
So what I’m trying to say is โ
![]()
THAT is the thing!!!! The derivative we need for Newton-Raphson is vega!!!
Eek!!! AND!!! We’ve already learned about vega before!!!
OK so. Now in our $y = f(x)$ Newton-Raphson recurrence,

the relationship between these โ how do we use it here~~
Based on everything above, we can just write it like this:

Let’s code it
Time to actually code it up and find the implied volatility.


In the output you’ll see a bunch of implied volatility values โ that’s because I tried it with a bunch of different initial volatility values. They all converge to the same number.
But โ you might be feeling a little uneasy about that initial volatility, right? And if you plug in something absurdly large there, vega comes out as 0, and the code just dies.
So picking the initial volatility appropriately turns out to matter.
I came across quite a bit of research on choosing that starting value. It’s not the focus of this lesson, so I’m leaving that detour aside rather than pretending the issue doesn’t exist.
The point is that convergence is local, not guaranteed for an arbitrary guess. The pictured Newton loops are demonstrations without an iteration cap or a small-vega/domain guard. A starting guess need not converge: stop explicitly on failure, keep volatility positive, and use a bracketed method when Newton cannot make a valid step.
(Historical volatility can be a starting guess, but it is not a convergence guarantee.)
Anyway, let’s keep moving heh heh


Python version!
import math
import scipy as sp
import scipy.stats
norm = sp.stats.norm(loc=0, scale=1)
def BS(S, k, r, sigma, t, opOption):
d1 = (math.log(S / k) + r * t) / (sigma * math.sqrt(t)) + 0.5 * sigma * math.sqrt(t)
d2 = d1 - (sigma * math.sqrt(t))
if opOption == True:
bi = 1
else:
bi = -1
BS = bi * (S*norm.cdf(bi*d1) - k*math.exp(-r*t)*norm.cdf(bi*d2))
return BS
def vega(S, k, r, sigma, t):
d1 = (math.log(S / k) + (r * t)) / (sigma * math.sqrt(t)) + 0.5 * sigma * math.sqrt(t)
vega = S*math.sqrt(t) * norm.pdf(d1)
return vega
def IV_using_NewtonRaphson(S, k, r, t, real_price, opOption, initial_sigma=1):
epsilon = 1e-12
if S <= 0 or k <= 0 or t <= 0:
raise ValueError("S, k and t must be positive")
discounted_strike = k * math.exp(-r * t)
lower = max(S - discounted_strike, 0) if opOption else max(discounted_strike - S, 0)
upper = S if opOption else discounted_strike
if not lower < real_price < upper:
raise ValueError("No finite positive implied volatility for this model price")
sigma = initial_sigma
if not math.isfinite(sigma) or sigma <= 0:
raise ValueError("Initial volatility must be finite and positive")
for i in range(100):
bs_value = BS(S, k, r, sigma, t, opOption)
diff = bs_value - real_price
if abs(diff) < epsilon:
return sigma
vega_value = vega(S, k, r, sigma, t)
if not math.isfinite(vega_value) or vega_value <= 1e-12:
raise RuntimeError("Vega is too small; use a bracketed method or another starting value")
next_sigma = sigma - diff / vega_value
if not math.isfinite(next_sigma) or next_sigma <= 0:
raise RuntimeError("Newton step left the positive-volatility domain; use a bracketed method")
sigma = next_sigma
raise RuntimeError("Newton-Raphson did not converge within the iteration limit")
S=50; k=50; r=0.1; t=0.5
real_price = 2.5
opOption=True
print(IV_using_NewtonRaphson(S=S, k=k, r=r, t=t, real_price=real_price, opOption=opOption))

Heads-up. The figures here are the original notes, slips and all. A few things to watch for:
- In the derivation pictures, the step needs a minus sign: from $f'(x_n)(x_{n+1} - x_n) = -f(x_n)$ it follows that $x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$, and for the volatility $\sigma_{n+1} = \sigma_n - \frac{BS(\sigma_n) - \text{market price}}{\text{vega}(\sigma_n)}$. The code in the post subtracts, as it should.
- In the handwritten Solve sub, the last Debug.Print should format the solution x_n, not c.
- In the VBA BS function, IIf(callput, 1, -1) should use the parameter: IIf(opOption, 1, -1). As written, callput is an empty, undeclared variable, so bi is always -1 and the function prices the put: the 1.2751106577 in the Immediate window is the put’s implied volatility, while the call’s is about 0.3964. In the vega function, s + Sqr(t) should be s * Sqr(t).
Questions or corrections?
Did a step lose you, or does a number look off? Email me or use the contact page. Include the note title and the step or figure you mean.
Feedback goes to me privately by email; it is not posted as a public comment.