# The Black Scholes Equation

Since I don’t have a finance background, I’ve always wondered what the big deal was with the Black-Scholes equation – like, what’s it supposed to do? Why is it the holy grail of finance equations? I found this great resource the other day, explaining the equation at a very high level: A Beginner’s Guide To The Black-Scholes Option Pricing Formula.

# What’s an option?

Basically, the equation is used to price options, which are contracts that allow a person to buy an asset at a certain price after a period of time. I liked the example from Rich’s blog:

Consider a European call option on a Microsoft share (the ‘asset’), with a strike of 30 (the ‘predetermined price’) and maturity of one year from today (the ‘predetermined date’). If I pay to enter into this contract I have the right but not the obligation to buy one share at 30 in a year’s time. Whether I actually exercise my right clearly depends on the share price in the market at that date:

– If the share price is above 30, say at 35, I can buy the share in the contract at 30 and sell it immediately at 35, making a profit of 5. Similarly if the share price is 40 I make a profit of 10.
– If the share price is below 30, say at 25, the fact that I have the right to buy at 30 is worthless: I can buy more cheaply in the open market.

Alternatively, you can think of insurance as an option – you pay a fee to your insurance company each month so that in the event of an accident, they will cover your medical expenses. If you don’t have an accident, you’re still out the money from the fee.

You should know there are lots of different types of options, like European options, American options, exotic options, etc. And for each type of option, you can either get a “call option” or a “put option.” A call option is when you want to buy an asset at a strike price, and a put option is when you want to sell an asset at a strike price. I found this Forbes article particularly well-written: Options Basics.

# The Black Scholes Equation

Now, how to price such a squirrely thing? For starters, you would need to know things like how volatile your asset is, what the risk free interest rate is (so that you can discount the future value back to present), an appropriate strike price, and the date you’re willing to allow the option to expire. So Scholes, Black, and Merton came up with this equation to describe the value of the option:

$\frac{\partial V}{\partial t} + \frac{1}{2} \sigma^2 S^2\frac{\partial^2 V}{\partial S^2} + rS\frac{\partial V}{\partial S} - rV = 0$

Initial Condition for a European call option:
$V(S,0) = \max{(S-E,0)}$

Boundary Conditions for a European call option:
$V(0,t) = 0$
$\lim_{S \to\infty}\frac{V(S,t)}{S} \rightarrow 1$

where:

• $V$ is the value of the option
• $S$ is the value of the asset
• $\sigma$ is the volatility of the asset
• $r$ is the risk free interest rate
• $t$ is time
• $E$ is the strike price

In mathematical terms, all of these option types (puts, calls, European, American, etc.) translate to different boundary conditions and initial conditions for the partial differential equation (PDE). It turns out that there is a closed form, analytical solution to the Black Scholes equation for just the European option case, which is the kind of option that only allows you to buy/sell after the expiration date. Other kinds of options, like American options, allow you to buy/sell at any time. Analytical solutions for the other types of options don’t exist or are too hard to come up with, so most people use numerical solutions.

# Analytical Solution

Remember the heat equation? (A refresher on the closely related wave equation is here: Why do drums and guitars sound differently?) The strategy for solving the BS equation analytically is to transform the equation to the form of the heat equation because we know how to solve equations in that form (we don’t know how to solve them when they’re in different forms). Yes, it’s very sad; of all the PDEs in the world, we can solve only a small subset of them analytically. The rest of them rely on numerical approximations. After a lot of work, the solution uses the cumulative distribution function for the Normal distribution (from probability & statistics).

# Numerical Solution

A numerical solution is different than the analytical solution because where the analytical solution gives us an equation, a numerical solution gives us only the equation evaluated at certain points. So the output of an analytical solution is an equation, but we get a set of points from the numerical solution. Numerical solutions may be evaluated at any point, or at as many points as you want, so it’s basically just as good as the analytical solution. When plotted with the analytical solution, really good numerical solutions are essentially identical.

The basic strategy in a numerical approximation is to discretize the space into a mesh, and then solve the PDE for each time step. As we continue solving, the mesh evolves in time until we tell it to stop (the expiration date for the option). To do this, you would use a Taylor series expansion to approximate the derivatives in the PDE. At a high level, the Taylor series is an infinite sum of the function and its derivatives (and some coefficients).

$f(x) = \sum^{\infty}_{k = 0} \frac{f^{(k)}(a) (x-a)^k}{k!}$

We expand around the nodes in the grid (see below), and then truncate the series at an acceptable error term. The farther you expand the series, the smaller your error becomes, and the better your approximation is. However, in practice, people usually expand only to the third or fourth term of the series. From the Taylor series, we get an approximation to the first and second derivatives, and those get plugged into the BS PDE.

Forward approximation to the first time derivative:
$\frac{\partial V}{\partial t} = \frac{w_{i,j+1}-w_{i,i}}{\Delta t}$

Centered approximation to the first asset value derivative:
$\frac{\partial V}{\partial S} = \frac{w_{i+1,j}-w_{i-1,j}}{2\Delta S}$

Centered approximation to the second asset value derivative:
$\frac{\partial^2 V}{\partial S^2} = \frac{w_{i+1,j}+w_{i-1,j}-2w_{i,j}}{\Delta S^2}$

where each $w_{i,j}$ corresponds to a point in this grid:

At the end, you get a numerical approximation (set of points) to the solution of the PDE, $V(S,t=T)$, where $T$ is the expiration date.

# Problems with assumptions

Like in any model, there are some assumptions we made in solving this equation that are unrealistic. For instance, the risk-free interest rate $r$ and the volatility of the stock $\sigma$ are assumed to be constant. In reality, this isn’t the case. But the bigger flaw is with the underlying logic in the PDE itself. Benoit Mandelbrot wrote in The (Mis)Behavior of Markets that the main issue in Black Scholes equation is that it assumes that stock prices behave according to the laws of Brownian Motion (this is why the Normal Distribution shows up in the analytical solution), which basically states that, like a vibrating particle in a molecule, stock prices deviate from their true price randomly, but within a certain radius.

In reality, stock prices are known to skyrocket and plummet well beyond this radius, so it seems that the underlying logic in the Black Scholes PDE doesn’t totally capture the true behavior of the market.

# Information, Instability and Fragility in Networks: Methods and Applications

This is a belated post… since the workshop took place a couple of months ago on Nov 15, 2013. I’ve been behind on my posts, what with last semester’s finals, getting my wisdom teeth out, and goofing off during winter break.

I attended this workshop to get ideas for my Master’s Thesis, and found a ton of inspiring and interesting work. This is the site for the workshop, and here is a blurb from the workshop’s coordinators:

“The purpose of of this interdisciplinary workshop is to exchange ideas and tools across disciplines dealing with network instability and fragility, and the propagation of information in networks. Registration is free, and you are welcome to attends all or some of the talks. We encourage you to attend and to forward this information to others who might be interested.”

This was the schedule:

Keynote Address (noon): Edward Ott (Maryland)
“The Influence of Network Topology on Stability of Discrete State Systems”

Financial Networks (morning):
Camelia Miniou (International Monetary Fund)
“Crisis Transmission in the Global Banking Network”
Andreea Minca (Cornell U)
“Systemic Risk with Central Counterparty Clearing”
Charlie Brummitt (UC Davis)
“Inside Money and Procyclical Leverage in a Simple Model of a Banking Crisis”
Michael Gofman (Wisconsin)
“Efficiency and Stability of a Financial Architecture with Too Interconnected to Fail Institutions”

Science and Engineering Networks (afternoon):
Juan G. Restrepo (U Colorado Boulder)
“Effect of network structure on the propagation of avalanches in networks”
Hongdian Yang (Johns Hopkins U)
“Studying information processing in neuronal networks with statistical mechanics and information theoretic approaches”
Aaron Clauset (U Colorado Boulder)
“A network approach to analyzing highly recombinant malaria parasite genes”
Ian Dobson (Iowa State U)
“Quantifying outage propagation and cascading in electric power networks”

Roundtable
Robin Lumsdaine (American U)
Raphael Levine (Hebrew U and UCLA)
Eric Renault (Brown U)
Michael Stutzer (U Colorado Boulder)
Wojciech Szpankowski (Purdue U)
David Wolpert (Santa Fe Inst.)

The workshop was a really good experience, and now I have a lot of ideas to ruminate over…

# Neat Math Blogs

I’ve stumbled across a couple of math blogs:

• Math With Bad Drawings
• Headlines from a Mathematically Literate World
• Our World: Gas Prices Hit Record High (Unadjusted for Inflation)

Mathematically Literate World: Gas Prices Hit Record High (In a Vacuous, Meaningless Sense)

• Our World: Psychologists Tout Surprising New Findings

Mathematically Literate World: Psychologists Promise to Replicate Surprising New Findings Before Touting Them

There’s a certain humor, excitement, and curiosity I found here that is encouraging and motivating. In the thick of mountains of homework and looming final exams, it’s easy to feel frustrated and disappointed with your life choices (why did I pick this major, these classes are pointless, I feel like I’m wasting away, why aren’t I doing something immediately helpful to others like building latrines in Nepal instead of this problem set, etc.), but I find that seeing such sincerity and genuine interest in these blogs rekindled some sense of purpose inside me.

# Math in Music

Ever wonder what the Golden Ratio sounds like? It’s hauntingly eerie and beautiful…

And this is a composer’s interpretation of fractal music (Gyorgy Ligeti):

It’s a really complicated piece that has so many different layers to it. Every time I listen to it, I hear something new.

“Fractals are patters which occur on many levels. This concept can be applied to any musical parameter. I make melodic fractals, where the pitches of a theme I dream up are used to determine a melodic shape on several levels, in space and time. I make rhythmic fractals, where a set of durations associated with a motive get stretched and compressed and maybe layered on top of each other. I make loudness fractals, where the characteristic loudness of a sound, its envelope shape, is found on several time scales. I even make fractals with the form of a piece, its instrumentation, density, range, and so on. Here I’ve separated the parameters of music, but in a real piece, all of these things are combined, so you might call it a fractal of fractals.”

-Gyorgy Ligeti, 1999 interview, The Discovery Channel

# One Way to Hack

This is a post from a series in my project.

In this age of information, cybersecurity is everything. It’s the reason why we have things like online banking and secure payment transactions for online shopping. Without certain security measures, your information is open on the web for anyone to grab. Cryptography is such a broad and deeply researched subject – this short post will not do it justice by any means.

Aside: The terms hacking and cracking have extremely different meanings, although they are usually taken to mean the same thing. Hacking pertains to making new discoveries, like scientists do when they try to cure cancer. Cracking means making discoveries for malicious intent, like people who steal your identity by giving your computer a keystroke-logging virus to steal your passwords or credit card numbers.

# What is Cryptography?

From the Greeks (as usual): crypto means secret and graphy means writing. Cryptography is the study of techniques for encrypting and decrypting secrets. There are many ways to code messages or information so that they are unreadable by others. Some of these techniques are easily broken, and some are hot research topics because they are so difficult to break. In 1977, three number theorists (Ron Rivest, Adi Shamir and Leonard Adleman) came up with an algorithm, called “RSA”, for creating unbreakable computer “keys.” The basic premise for their idea is summarized below:

Imagine you want to send a secret message to your friend Alice. You put the message in a box that has two keyholes and one key is taped to its side, key A. Whenever the box is locked with key A, it can only be opened by key B. Similarly, if you lock the box with key B, you can only open it with key A. Key A is public. Anyone can use it (it’s taped to the box). Key B is private. Only your friend has access to this key. Here is the procedure for securing your message:

1. Lock your box with key A.
2. Send the message to your friend. Since only key B can open the box, no one can look inside except your friend.
3. Your friend receives the box and opens it with key B, fully confident that no one else has read the message.

In this picture, Eve is trying to read the message between Alice and Bob, but she can’t do it unless she has the private key.

The trick in this method is in the kinds of keys that you have. First of all, they are digital keys, since all of this is taking place on your computer. RSA-generated keys are created by multiplying huge (like thousands of digits) prime numbers together to make another, bigger number. Just a refresher: prime numbers are special numbers that cannot be divided by any other number than themselves and 1 (e.g., 1, 3, 5, 7, 11, 13, 17, 19, 23, …).

Here is the basic idea:

1. Multiply two large prime numbers $n=p,q$
2. Next, find $k = (p-1)(q-1)$
3. Find a number $e$ that is between $1,k$ and not a factor of $k$. In other words, $1 \leq e \leq k$.
4. Calculate $d,v$ so that $de - vk =1$. Don’t worry: a certain theorem of number theory says that $d,v$ will always exist.
5. Finally, we erase what we have for $p,q,k,v$
6. $(n,e)$ forms the public key and $(n,d)$ the private key.

To illustrate this: the epitome of nerdiness. A specific example follows.

1. Choose $p=11$ and $q=13$. We have $n=143$ and $k=120$
2. Let us choose $e=7$
3. We have to find $d,v$ so that $13d - 120v = 1$. We have $d=103$ and $v=6$
4. The private key is $(143,7)$. The public key is $(143,103)$

The encryption process takes a message $M$, which is a number from $1, ... n-1$, and transforms it by the following operation:

$M^e \mod n = E$

Here, the $\mod$ operator represents the modulus. A modulus is the remainder $r$ after division (e.g., $\frac{5}{3} = 1$ with $r=2$  and  $5\mod 3 = r =2$).

For example, the public key $(143,7)$ and message $M = 72$, becomes $E=72^7 \mod 143 = 19$.

Undoing this process to read $M$ is called decryption. To decrypt, we have to compute:
$E^d \mod n = 19^{103} \mod 143$
$= ((19^{10})^{10} \mod 143) * (19 \mod 143)$
$= (56^{10}*19^3) \mod 143$
$= (100*138) \mod 143$
$= 72$

We have the original message again. Obviously, there are a lot of steps to “secretize” your information, but they are worth it. If you only have the public key $(n,e)$, it is impossible to figure out what the original message is. But, if you know what the factors of $n$ are ($p,q$), then you can easily back-calculate all the steps required to find the private key $(n,d)$. There is one caveat to this method, though. Public and private keys are for one-time-use only. After you send the message and your friend receives it, you two should never use those keys again. It is simply too risky – if someone is watching your communications and knows you have sent 2-3 messages in the same encrypted pattern, they can deduce the private key.

# How to (try) to break RSA

Your online privacy depends on the impossible-to-break nature of RSA. There are a class of problems in computer science which do not have any known algorithms, NP (Non-Deterministic Polynomial Time) problems. Factoring large numbers is an NP problem. In other words, once you multiply two huge, beastly prime numbers, it is impossible for someone to find out what those particular primes are if they only have the product. If it were easy, people could factor $n$ to find $p,q$ and reverse engineer the private key.

The reason why factoring is such a difficult problem has to do with the Fundamental Theorem of Arithmetic. The theorem states that every number can be broken down in to a product of prime numbers. For instance:

$24 = 8*3 = 2^3 * 3$
$100 = 5*20 = 2^2*5$
$2040 = 2*1020 = 2^2*510 = 2^3*255 = 2^3*5*51 = 2^3*5*3*17$
$1923 = 3*641$

If you choose two prime numbers to multiply together, the product can only be broken down into two numbers, like the number $1923$. However, if you choose any two large numbers, you are not guaranteed this quality, like in the number $2040$. There are many factors that divide $2040$, but only two that will divide $1923$. In other words, the chances of finding factors for $2040$ are much higher than the chances for finding the factors of $1923$. The odds diminish significantly the larger and larger you make the prime numbers – that’s why RSA keys are thousands of digits long.

Two relatively simple examples:

1.
$n = p*q$
$n = 810932741738789015214091083277$
$p = 876465752114783$
$q = 925230380972819$

An easier problem:
2.
$\hat{n} = 55$
$\hat{p} = 5$
$\hat{q} = 11$

How would you begin factoring numbers like $n$ or $\hat{n}$? The first thing to come to mind might be trying to divide $n$ or $\hat{n}$ by all of the numbers before them until you find a number that evenly divides out, kind of like:

$\frac{55}{1},\frac{55}{2},\frac{55}{3},\frac{55}{4},\frac{55}{5}...$

For $\hat{n}$, see that once you only take a few steps to reach $5$. Instantly, you see $\frac{55}{5} = 11$. Success! This method will certainly find factors for both $n$ and $\hat{n}$, but it will take much longer for you to find the factors of $n$ than $\hat{n}$ simply because there is such a large difference in magnitude. If you tell the computer to do these steps with number on the order of the same magnitude as $n$, you would be waiting a really long time for the results. There are research labs that are trying to work on new ways to factor numbers that are much, much larger than $n$ ($n$ is thirty digits long. Actual RSA keys are thousands of digits long). There is a cleverer solution. A research paper by Eric Bach (1991) explores the Pollard’s Rho method for factoring prime numbers. It is a method grounded in probability theory, and draws on the implications of the Birthday Paradox.

# The birthday paradox

Essentially what the Birthday Paradox asks is: How many people do you need to talk to before the probability of two people sharing the same birthday (month and day) is 50%? If you ask 367 people, the probability is certainly 100%. If you ask two people, the probability is 0.27%.

Click here for a demonstration of the results.

As it turns out, you only need to ask ~23 people before you have a 50-50 chance of a collision of 2 people born on the same day.

#### The take-away point of the Birthday Paradox is that you need a much smaller sample size (23 people) out of a much larger range of possibilities (367 people) to increase your odds of a collision to as high as 50%.

Pollard’s rho works on this principle. Of the range $1... n$, you only need to sample $w << n$ numbers to find the factors that you’re looking for. Of course, when $n$ is very, very large, the algorithm doesn’t work as fast. But for numbers that are about 30 digits long, Pollard’s rho outperforms trial division enormously.

If you’re truly curious, this is a neat video that explains how to solve the problem. It’s not necessary to watch this to understand Pollard’s rho.

# Pollard’s rho

The Pollard’s rho algorithm is a surprisingly simple algorithm for factoring numbers. Some people may consider it outdated by today’s standards of cutting-edge number factoring algorithms, but it outperforms trial division (walking through every number from 1 until $n$) by a significant order of magnitude. John M. Pollard came up with this algorithm in 1975 and Richard Brent added a few modifications to it in 1980. This is the basic scheme:

• Generate $k$ random numbers based on the magnitude of the number you would like to factor. The “random walk” is not actually random because we are going to use a function $f(x)$ to generate these numbers, however it will look and feel random.
• $f(x) = x^2 + a \mod n$, where $a$ is a computer generated random number. $f(x)$ is recursive, which means that whatever you get from the first iteration of $f(x)$, you take that result and you use it as your new input for the function. Another way to see it: $x_{n+1} = f(x_n)$
• We can pick numbers $x_1, ... x_w$ and instead of asking if any one of those random numbers divides $n$, we can ask if the greatest common denominator of $n$ and the difference between two random numbers is greater than 1. That is: $GCD(|x_i - x_j|,n)>1$. Asking for a non-trivial factor in common increases the number of chances for successes. Thus, if $GCD(|x_i - x_j|,n)>1$, $GCD(|x_i - x_j|,n)$ is either $p$ or $q$.
• The reason why we have more chances of success when looking for $GCD(|x_i - x_j|,n)>1$ is because when you ask how many numbers divide $n$, your answer is two: $p,q$. When you ask how many multiples of $p,q$ share factors with $n$, you have precisely $p+q-2$ numbers because:
$p,2p,3p,4p,5p, ... (q-1)p, q,2q,3q,4q,...(p-1)q$

# An example

You can implement Pollard’s rho in any programming language you please. It is fortuitous that Java has a BigInteger package that can handle numbers with more than 20 digits, so it seems the most natural to me to code this up in Java. This is just a snippet of pseudocode (Pseudocode is not actually code that would run on a computer. Its purpose is to illustrate what steps should happen at which point of the algorithm for clarification). The phrase “while” means “while the statement is true, repeat this operation.”

set x = 2
set y = 2
while ( y does not equal x )
find f(x)
find f(f(y))
if GCD( | y - x | , n) > 1
p = GCD( | y - x | , n)
stop looping
return p

Notice that we calculate $f(f(y))$. This is the change that Floyd made to Pollard’s algorithm. When you run the loop without this extra calculation, sometimes you can get stuck in an infinitely looping disaster like below:

$2,10,\mathbf{16,23,29},13,\mathbf{16,23,29},13,...$

To prevent this from happening, Floyd said something like, “Let’s pretend there are two racers on a circular track. They will start at the same time and place, but runner B will run twice as fast as runner A. When runner B passes runner A (the stopping condition for the loop, y = x), we know that we are caught in a repeating cycle. Tell the computer to stop looping. Restart the runners with a new random seed and try again.” Floyd’s cycle-detection scheme saves us from worrying about repeating values.

# Be glad computers can’t factor

The people who work in cryptography and cybersecurity are notoriously paranoid. When they get wind of the slightest hint of anyone coming up with a way to factor numbers that are hundreds of digits long, they instantly get to work to create bigger and bigger keys. Their worry is rightly justified, though. If someone were to come up with a way to quickly factor numbers, we’d be cooked. Say good-bye to online shopping, online banking, online bill pay, online taxes, direct deposit,… pretty much online-anything.

# How to Gamble (Roulette)

This is a post from a series in my project.

Historically, many people have been drawn to the allure of roulette (the gambling game) due to its irresistible deterministic nature (a system in which no randomness is involved; it always produces the same output from a given starting condition). This research paper by Small and Tse explores the mathematics (specifically the chaotic dynamics) in a roulette wheel. They outline a short review of the history of the game and provide their own model to maximize profits. The authors believe that the “relatively simple laws of motion allow one, in principle, to forecast the path of the ball on the roulette wheel and to its final destination.” Small and Tse show that if a player knew the position, velocity, and acceleration of the ball, the player would be able to predict the outcome of the game with reasonable accuracy. They also explore how a very slightly tilted surface has an enormous effect on the results of the game. They claim their model can achieve an expected return of 18%, which is significantly higher than the commonly accepted 2.7% return from a random bet. This paper draws from chaos theory and probability theory to make its conclusions, and is a good example of how mathematics can be used in practical applications.

I found a neat YouTube video about the expected return of roulette. There’s some cheesy humor in the video, but overall, this woman clearly walks you through how you would calculate your expected winnings (or losses) in 1 game of roulette with specific parameters.

It is generally accepted that the house will pay 35 to 1 when you win at roulette. Therefore, on a wheel with 37 pockets, the expected return from one bet is:

$(35+1)\frac{1}{37}-1\approx2.7\%$

# A brief history

Roulette is the oldest casino game. Like other casino games, it is carefully designed to take you for all you’re worth. Basically what happens is: there’s a heavy wheel, machined and balanced to minimize friction, with colored notches and a plastic ball that whirls around the wheel as you spin it. The wheel is designed to spin for a really long time with a slowly decaying angular velocity. When the wheel stops spinning, the ball will too. The aim of the game is to bet on where (which numbered notch/pocket) you think the ball will land. The wheel is designed in such a way that the pockets are numbered consecutively and red and black colors alternate. I can’t summarize the game’s history better than the original authors:

The origin of the game has been attributed, perhaps
erroneously, to the mathematician Blaise Pascal. Despite
the roulette wheel becoming a staple of probability theory,
the alleged motivation for Pascal’s interest in the device was
not solely to torment undergraduate students, but rather as
part of a vain search for perpetual motion. Alternative stories
have attributed the origin of the game to the ancient Chinese,
a French monk or an Italian mathematician. In any case,
the device was introduced to Parisian gamblers in the mid-eighteenth
century to provide a fairer game than those currently in circulation.

I’ll be honest. Before reading this paper, I had no interest in playing roulette. Even worse, I had no idea even how to play. So for those of us who either live under a rock or are generally unaware of the goings-on at casinos, let’s start at the beginning: How do you play roulette? (I started at this site.) Wikipedia has a neat how-to-play article, too.

# How to play roulette

1. Figure out whether you’re playing on a European (more fair) or American (less fair) wheel. (American wheels have slots that go from 00, 0, 1, 2, … 35, 36, whereas European wheels do not feature the 00. Their numbers go from 0, 1, 2, … 35, 36)
2. Get some $$dollarz$$ to play.
3. Decide on a bet to place. You can bet on as little as just 1 number or as many as 18 numbers. You increase your chances of winning if you bet on more numbers.
4. Place your bet. Where to place your bet depends on what kind of bet you decided to pick in the first place. There are different places for different types of bets.
5. When the dealer says, “Place your bets!”, you should place your bets.
6. The dealer will then spin the wheel.
7. It should go without saying that when the dealer says, “No more bets.”, you can’t place any more bets.

This video shows you how the wheel and ball are spun:

# Winning strategy

There are two ways to win at roulette:

1. Hope you get an unbalanced wheel and be prepared to exploit this handy fact.
2. Base your strategy off of the deterministic nature of the spin of the ball and the wheel.

Casinos will do their best to prevent (1) from happening, but they can’t do anything about (2). The reason why they can’t prevent (2) from happening is because bets are allowed to be placed after the wheel has started spinning. This means you can observe the motion of the ball and the wheel before placing a wager.

# People who have (successfully) tried to cheat

History is littered with people trying to squeeze money out of casinos. Here is a brief overview of a few that stand out.

• In 1873, an English mechanic and amateur mathematician who went by the name of Jagger carefully observed six roulette wheels at the Monte Carlo casino. He and his assistants logged the outcome of the each spin of the wheel for five weeks. Analysis of their data showed that each wheel had a unique bias due to factory imperfections which Jagger was quick to exploit. According to some sources, Jagger walked away with £65,000.
• In his daydreams about the nature of chance, Henri Poincaré used a slightly different version of a roulette wheel to show how sensitivity to initial conditions can be used to figure out the ultimate resting state of the wheel. Aside: sensitivity to initial conditions forms a cornerstone of modern chaos theory.
• This report from the BBC in 2004 describes three gamblers who were arrested for hiding a laser scanner in their smartphones to predict where the roulette ball would most likely stop (based on the laser’s estimation of the ball’s velocity and position). Luckily for the gamblers (and not for the casino), they were released without any charges and were allowed to keep their £1.3 million winnings. The laser from the smart phone was linked to a computer that was able to make calculations fast enough for the three to make their bets before the dealer said, “No more bets.” The work of Small and Tse are extremely similar to this case.

# The model

Let’s use polar coordinates to describe the position of the ball, since we are on a wheel. We normally use Cartesian coordinates – the x-y plane – but due to the symmetry and naturally circular state of our system, polar coordinates are more intuitive. Polar coordinates describe location in space in terms of the distance from the origin $r$ and angle measurement $\theta$. The picture below describes the transformation from Cartesian to polar coordinates.

The authors model the ball as a single point, so its position in $r$ can vary between $[0, r_{rim}]$, where $r_{rim}$ represents the farthest point from the middle of the wheel that the ball can be – the very edge of the wheel. Similarly, $r_{defl}$ is the radial distance to the location of the metal deflectors on the fixed part of the wheel (stator). $\phi$ is the angle of rotation of the inner wheel.

The picture above also shows a free-body diagram of the forces acting on the ball as it travels on the roulette wheel. $m$ is the mass of the ball. The angle $\alpha$ is the angle of incline of the stator, and $a_c$ is the radial acceleration of the ball. Obviously, $g$ is gravity. The authors assume that the deflectors are evenly distributed around the stator at constant radius $r_{defl} < r$. In terms of a derivative, this means $\frac{d r_{defl}}{d \theta} = 0$. There are going to be two models here: one model with a completely horizontal table and one model with a tilted surface. Comparing the two results shows how critical it is for the roulette wheel to be on a totally flat surface.

### The completely flat table

The point in time $t_{defl}$ we are interested in is when $r = r_{defl}$. In other words, we are looking for the time when the ball settles down in a pocket. Before the ball settles down, it will pass through four distinct states:

1. Sufficient momentum to remain on the rim
• While on the rim, $r$ is constant, and the ball has a varying angular velocity $\dot{\theta}$. $\theta$ decays only due to a constant rolling friction.
2. Insufficient momentum; leaves the rim
• The ball leaves the rim at the point where its velocity squared is: $\dot{\theta}^2 = \frac{g}{r}\tan \alpha$.
• The time this happens is: $t_{rim} = -\frac{1}{\ddot{\theta}(0)}(\dot{\theta}(0)-\sqrt{\frac{g}{r}\tan \alpha})$
3. Moving freely on the stator
• Due to the force of gravity and the centripetal force, the ball’s radial position decreases. Integrating this differential equation reveals the ball’s position: $\ddot{r} = r\dot{\theta}^2\cos \alpha - g\sin \alpha$
• As it turns out, for a level table, the time spent from leaving the rim of the wheel (1) until the ball is about to hit the deflectors (4) is fairly consistent because the ball leaves the stator with exactly the same velocity $\dot{\theta}$ each time. Thus, it is possible to estimate the position of the ball without having to integrate the equation above by using tabulated numbers.
4. Settling into a pocket
• The instantaneous angular deflection of the ball: $\theta(t_{defl})=\theta(0)+\dot{\theta}(0)t_{defl}+\frac{1}{2}\ddot{\theta}(0)t_{defl}^2$
• The instantaneous angular deflection of the wheel: $\phi(t_{defl})=\phi(0)+\dot{\phi}(0)t_{defl}+\frac{1}{2}\ddot{\phi}(0)t_{defl}^2$
• The angular location on the wheel where the ball strikes a deflector: $\gamma = |\theta(t_{defl})-\phi(t_{defl})|_{2\pi}$. Here, $|\cdot|_{2\pi}$ represents modulo $2\pi$. A modulo operation returns the remainder after division of two numbers (e.g., 5 mod 4 = 1, 9 mod 10 = 9, -2 mod 3 = 1, …)

### The tilted table

• Due to the change in the position of the wheel, it now has new equilibrium points. As a result, its angular velocity changes. Now, $\dot{\theta} = \sqrt{\frac{g}{r}\tan(\alpha+\delta \cos \theta)}$
• The intersection of the above equation and this one will be the point the ball leaves the rim: $\dot{\theta} = \dot{\theta}(t_1) - \frac{1}{2\pi}(\dot{\theta}(t_2) - \dot{\theta}(t_1))\theta$
• For a tilted roulette wheel, the ball will favor one half of a wheel more than the other.
• A tilt of about 0.2 degrees is more than sufficient to bias the wheel.

After presenting these mathematical models for the motion of the wheel and the ball, the authors delve into some pretty lengthy and intense numerical simulations that support their model. They examine the sensitivity of their model to parameter uncertainty to see what sort of changes casinos may have to make to their roulette tables in order for the house to have a natural advantage (good news for the casinos; it’s only minor adjustments). The authors also realize that the game is truly predictable with some degree of certainty (good news for gamblers; this is a relatively honest game).

And finally for a fun bit of trivia: According to HowStuffWorks.com, the most frequently chosen number in roulette is 17 because that’s the number James Bond played in the movies.