# House edge & online gambling mathematics

We thought it might be interesting to gather some online gambling mathematics ideas and theories and collect them in one article. Thanks of course to Wiki which has billions of pages of random useful (and often non useful) information!

## Gambling mathematics

The mathematics of gambling are a collection of probability applications encountered in games of chance and can be included in game theory. From a mathematical point of view, the games of chance are experiments generating various types of aleatory events, the probability of which can be calculated by using the properties of probability on a finite space of events.

### Contents

• 1 Experiments, events, probability spaces
• 2 The probability model
• 3 Combinations
• 4 Expectation and strategy
• 5 House advantage or edge
• 6 Standard deviation

### Experiments, events, probability spaces

The technical processes of a game stand for experiments that generate aleatory events. Here are a few examples:

• Throwing the dice in craps is an experiment that generates events such as occurrences of certain numbers on the dice, obtaining a certain sum of the shown numbers, and obtaining numbers with certain properties (less than a specific number, higher than a specific number, even, uneven, and so on). The sample space of such an experiment is {1, 2, 3, 4, 5, 6} for rolling one die or {(1, 1), (1, 2), …, (1, 6), (2, 1), (2, 2), …, (2, 6), …, (6, 1), (6, 2), …, (6, 6)} for rolling two dice. The latter is a set of ordered pairs and counts 6 x 6 = 36 elements. The events can be identified with sets, namely parts of the sample space. For example, the event occurrence of an even number is represented by the following set in the experiment of rolling one die: {2, 4, 6}.
• Spinning the roulette wheel is an experiment whose generated events could be the occurrence of a certain number, of a certain color or a certain property of the numbers (low, high, even, uneven, from a certain row or column, and so on). The sample space of the experiment involving spinning the roulette wheel is the set of numbers the roulette holds: {1, 2, 3, …, 36, 0, 00} for the American roulette, or {1, 2, 3, …, 36, 0} for the European. The event occurrence of a red number is represented by the set {1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36}. These are the numbers inscribed in red on the roulette wheel and table.
• Dealing cards in blackjack is an experiment that generates events such as the occurrence of a certain card or value as the first card dealt, obtaining a certain total of points from the first two cards dealt, exceeding 21 points from the first three cards dealt, and so on. In card games we encounter many types of experiments and categories of events. Each type of experiment has its own sample space. For example, the experiment of dealing the first card to the first player has as its sample space the set of all 52 cards (or 104, if played with two decks). The experiment of dealing the second card to the first player has as its sample space the set of all 52 cards (or 104), less the first card dealt. The experiment of dealing the first two cards to the first player has as its sample space a set of ordered pairs, namely all the 2-size arrangements of cards from the 52 (or 104). In a game with one player, the event the player is dealt a card of 10 points as the first dealt card is represented by the set of cards {10♠, 10♣, 10♥, 10♦, J♠, J♣, J♥, J♦, Q♠, Q♣, Q♥, Q♦, K♠, K♣, K♥, K♦}. The event the player is dealt a total of five points from the first two dealt cards is represented by the set of 2-size combinations of card values {(A, 4), (2, 3)}, which in fact counts 4 x 4 + 4 x 4 = 32 combinations of cards (as value and symbol).
• In 6/49 lottery, the experiment of drawing six numbers from the 49 generates events such as drawing six specific numbers, drawing five numbers from six specific numbers, drawing four numbers from six specific numbers, drawing at least one number from a certain group of numbers, etc. The sample space here is the set of all 6-size combinations of numbers from the 49.
• In draw poker, the experiment of dealing the initial five card hands generates events such as dealing at least one certain card to a specific player, dealing a pair to at least two players, dealing four identical symbols to at least one player, and so on. The sample space in this case is the set of all 5-card combinations from the 52 (or the deck used).
• Dealing two cards to a player who has discarded two cards is another experiment whose sample space is now the set of all 2-card combinations from the 52, less the cards seen by the observer who solves the probability problem. For example, if you are in play in the above situation and want to figure out some odds regarding your hand, the sample space you should consider is the set of all 2-card combinations from the 52, less the three cards you hold and less the two cards you discarded. This sample space counts the 2-size combinations from 47.

### The probability model

A probability model starts from an experiment and a mathematical structure attached to that experiment, namely the space (field) of events. The event is the main unit probability theory works on. In gambling, there are many categories of events, all of which can be textually predefined. In the previous examples of gambling experiments we saw some of the events that experiments generate. They are a minute part of all possible events, which in fact is the set of all parts of the sample space.
For a specific game, the various types of events can be:

• Events related to your own play or to opponents’ play;
• Events related to one person’s play or to several persons’ play;
• Immediate events or long-shot events.

Each category can be further divided into several other subcategories, depending on the game referred to. These events can be literally defined, but it must be done very carefully when framing a probability problem. From a mathematical point of view, the events are nothing more than subsets and the space of events is a Boolean algebra. Among these events, we find elementary and compound events, exclusive and nonexclusive events, and independent and non-independent events.
In the experiment of rolling a die:

• Event {3, 5} (whose literal definition is occurrence of 3 or 5) is compound because {3, 5}= {3} U {5};
• Events {1}, {2}, {3}, {4}, {5}, {6} are elementary;
• Events {3, 5} and {4} are incompatible or exclusive because their intersection is empty; that is, they cannot occur simultaneously;
• Events {1, 2, 5} and {2, 5} are nonexclusive, because their intersection is not empty;
• In the experiment of rolling two dice one after another, the events obtaining 3 on the first die and obtaining 5 on the second die are independent because the occurrence of the second event is not influenced by the occurrence of the first, and vice versa.

In the experiment of dealing the pocket cards in Texas Hold’em Poker:

• The event of dealing (3♣, 3♦) to a player is an elementary event;
• The event of dealing two 3’s to a player is compound because is the union of events (3♣, 3♠), (3♣, 3♥), (3♣, 3♦), (3♠, 3♥), (3♠, 3♦) and (3♥, 3♦);
• The events player 1 is dealt a pair of kings and player 2 is dealt a pair of kings are nonexclusive (they can both occur);
• The events player 1 is dealt two connectors of hearts higher than J and player 2 is dealt two connectors of hearts higher than J are exclusive (only one can occur);
• The events player 1 is dealt (7, K) and player 2 is dealt (4, Q) are non-independent (the occurrence of the second depends on the occurrence of the first, while the same deck is in use).

These are a few examples of gambling events, whose properties of compoundness, exclusiveness and independency are easily observable. These properties are very important in practical probability calculus.
The complete mathematical model is given by the probability field attached to the experiment, which is the triple sample space—field of events—probability function. For any game of chance, the probability model is of the simplest type—the sample space is finite, the space of events is the set of parts of the sample space, implicitly finite, too, and the probability function is given by the definition of probability on a finite space of events:

### Combinations

Games of chance are also good examples of combinations, permutations and arrangements, which are met at every step: combinations of cards in a player’s hand, on the table or expected in any card game; combinations of numbers when rolling several dice once; combinations of numbers in lottery and bingo; combinations of symbols in slots; permutations and arrangements in a race to be bet on, and the like. Combinatorial calculus is an important part of gambling probability applications. In games of chance, most of the gambling probability calculus in which we use the classical definition of probability reverts to counting combinations. The gaming events can be identified with sets, which often are sets of combinations. Thus, we can identify an event with a combination.
For example, in a five draw poker game, the event at least one player holds a four of a kind formation can be identified with the set of all combinations of (xxxxy) type, where x and y are distinct values of cards. This set has 13C(4,4)(52-4)=624 combinations. Possible combinations are (3♠ 3♣ 3♥ 3♦ J♣) or (7♠ 7♣ 7♥ 7♦ 2♣). These can be identified with elementary events that the event to be measured consists of.

### Expectation and strategy

Games of chance are not merely pure applications of probability calculus and gaming situations are not just isolated events whose numerical probability is well established through mathematical methods; they are also games whose progress is influenced by human action. In gambling, the human element has a striking character. The player is not only interested in the mathematical probability of the various gaming events, but he or she has expectations from the games while a major interaction exists. To obtain favorable results from this interaction, gamblers take into account all possible information, including statistics, to build gaming strategies. The predicted average gain or loss is called expectation or expected value and is the sum of the probability of each possible outcome of the experiment multiplied by its payoff (value). Thus, it represents the average amount one expects to win per bet if bets with identical odds are repeated many times. A game or situation in which the expected value for the player is zero (no net gain nor loss) is called a fair game. The attribute fair refers not to the technical process of the game, but to the chance balance house (bank)–player.
Even though the randomness inherent in games of chance would seem to ensure their fairness (at least with respect to the players around a table—shuffling a deck or spinning a wheel do not favor any player except if they are fraudulent), gamblers always search and wait for irregularities in this randomness that will allow them to win. It has been mathematically proved that, in ideal conditions of randomness, and with negative expectation, no long-run regular winning is possible for players of games of chance. Most gamblers accept this premise, but still work on strategies to make them win either in the short term or over the long run.

### House advantage or house edge

Casino games provide a predictable long-term advantage to the casino, or “house”, while offering the player the possibility of a large short-term payout. Some casino games have a skill element, where the player makes decisions; such games are called “random with a tactical element.” While it is possible through skilful play to minimize the house advantage, it is extremely rare that a player has sufficient skill to completely eliminate his inherent long-term disadvantage (the house edge or house vigorish) in a casino game. Common belief is that such a skill set would involve years of training, an extraordinary memory and numeracy, and/or acute visual or even aural observation, as in the case of wheel clocking in Roulette. For more examples see Advantage gambling.
The player’s disadvantage is a result of the casino not paying winning wagers according to the game’s “true odds”, which are the payouts that would be expected considering the odds of a wager either winning or losing. For example, if a game is played by wagering on the number that would result from the roll of one die, true odds would be 5 times the amount wagered since there is a 1/6 probability of any single number appearing. However, the casino may only pay 4 times the amount wagered for a winning wager.
The house edge (HE) or vigorish is defined as the casino profit expressed as a percentage of the player’s original bet. In games such as Blackjack or Spanish 21, the final bet may be several times the original bet, if the player doubles or splits.
Example: In American Roulette, there are two zeroes and 36 non-zero numbers (18 red and 18 black). If a player bets $1 on red, his chance of winning$1 is therefore 18/38 and his chance of losing $1 (or winning -$1) is 20/38.
The player’s expected value, EV = (18/38 x 1) + (20/38 x -1) = 18/38 – 20/38 = -2/38 = -5.26%. Therefore, the house edge is 5.26%. After 10 rounds, play $1 per round, the average house profit will be 10 x$1 x 5.26% = $0.53. Of course, it is not possible for the casino to win exactly 53 cents; this figure is the average casino profit from each player if it had millions of players each betting 10 rounds at$1 per round.
The house edge of casino games vary greatly with the game. Keno can have house edges up to 25%, slot machines can have up to 15%, while most Australian Pontoon games have house edges between 0.3% and 0.4%.
The calculation of the Roulette house edge was a trivial exercise; for other games, this is not usually the case. Combinatorial analysis and/or computer simulation is necessary to complete the task.
In games which have a skill element, such as Blackjack or Spanish 21, the house edge is defined as the house advantage from optimal play (without the use of advanced techniques such as card counting or shuffle tracking), on the first hand of the shoe (the container that holds the cards). The set of the optimal plays for all possible hands is known as “basic strategy” and is highly dependent on the specific rules, and even the number of decks used. Good Blackjack and Spanish 21 games have house edges below 0.5%.
Online slot games often have a published Return to Player (RTP) percentage that determines the theoretical house edge. Some software developers choose to publish the RTP of their slot games while others do not. Despite the set theoretical RTP, almost any outcome is possible in the short term.

### Standard deviation

The luck factor in a casino game is quantified using standard deviation (SD). The standard deviation of a simple game like Roulette can be simply calculated because of the binomial distribution of successes (assuming a result of 1 unit for a win, and 0 units for a loss). For the binomial distribution, SD is equal to n p q {\displaystyle {\sqrt {npq}}} , where n {\displaystyle n} is the number of rounds played, p {\displaystyle p} is the probability of winning, and q {\displaystyle q} is the probability of losing. Furthermore, if we flat bet at 10 units per round instead of 1 unit, the range of possible outcomes increases 10 fold. Therefore, SD for Roulette even-money bet is equal to 2 b n p q {\displaystyle 2b{\sqrt {npq}}} , where b {\displaystyle b} is the flat bet per round, n {\displaystyle n} is the number of rounds, p = 18 / 38 {\displaystyle p=18/38} , and q = 20 / 38 {\displaystyle q=20/38} .
After enough large number of rounds the theoretical distribution of the total win converges to the normal distribution, giving a good possibility to forecast the possible win or loss. For example, after 100 rounds at $1 per round, the standard deviation of the win (equally of the loss) will be 2 ⋅$ 1 ⋅ 100 ⋅ 18 / 38 ⋅ 20 / 38 ≈ $9.99 {\displaystyle 2\cdot \$1\cdot {\sqrt {100\cdot 18/38\cdot 20/38}}\approx \$9.99} . After 100 rounds, the expected loss will be 100 ⋅$ 1 ⋅ 2 / 38 ≈ $5.26 {\displaystyle 100\cdot \$1\cdot 2/38\approx \$5.26} . The 3 sigma range is six times the standard deviation: three above the mean, and three below. Therefore, after 100 rounds betting$1 per round, the result will very probably be somewhere between − $5.26 − 3 ⋅$ 9.99 {\displaystyle -\$5.26-3\cdot \$9.99} and − $5.26 + 3 ⋅$ 9.99 {\displaystyle -\$5.26+3\cdot \$9.99} , i.e., between -$34 and$24. There is still a ca. 1 to 400 chance that the result will be not in this range, i.e. either the win will exceed $24, or the loss will exceed$34.
The standard deviation for the even-money Roulette bet is one of the lowest out of all casinos games. Most games, particularly slots, have extremely high standard deviations. As the size of the potential payouts increase, so does the standard deviation.
Unfortunately, the above considerations for small numbers of rounds are incorrect, because the distribution is far from normal. Moreover, the results of more volatile games usually converge to the normal distribution much more slowly, therefore much more huge number of rounds are required for that.
As the number of rounds increases, eventually, the expected loss will exceed the standard deviation, many times over. From the formula, we can see the standard deviation is proportional to the square root of the number of rounds played, while the expected loss is proportional to the number of rounds played. As the number of rounds increases, the expected loss increases at a much faster rate. This is why it is practically impossible for a gambler to win in the long term (if they don’t have an edge). It is the high ratio of short-term standard deviation to expected loss that fools gamblers into thinking that they can win.
The volatility index (VI) is defined as the standard deviation for one round, betting one unit. Therefore, the VI for the even-money American Roulette bet is 18 / 38 ⋅ 20 / 38 ≈ 0.499 {\displaystyle {\sqrt {18/38\cdot 20/38}}\approx 0.499} .
The variance v {\displaystyle v} is defined as the square of the VI. Therefore, the variance of the even-money American Roulette bet is ca. 0.249, which is extremely low for a casino game. The variance for Blackjack is ca. 1.2, which is still low compared to the variances of electronic gaming machines (EGMs).
Additionally, the term of the volatility index based on some confidence intervals are used. Usually, it is based on the 90% confidence interval. The volatility index for the 90% confidence interval is ca. 1.645 times as the “usual” volatility index that relates to the ca. 68.27% confidence interval.
It is important for a casino to know both the house edge and volatility index for all of their games. The house edge tells them what kind of profit they will make as percentage of turnover, and the volatility index tells them how much they need in the way of cash reserves. The mathematicians and computer programmers that do this kind of work are called gaming mathematicians and gaming analysts. Casinos do not have in-house expertise in this field, so they outsource their requirements to experts in the gaming analysis field.
Wiki

## Casino Game

Games available in most casinos are commonly called casino games. In a casino game, the players gamble casino chips on various possible random outcomes or combinations of outcomes. Casino games are also available in online casinos, where permitted by law. Casino games can also be played outside casinos for entertainment purposes like in parties or in school competitions, some on machines that simulate gambling.

### Contents

• 1 Categories
• 2 Table games
• 3 Common non-table games
• 3.1 Gaming machines
• 3.2 Random numbers
• 4.1 Standard deviation

### Categories

There are three general categories of casino games: table games, electronic gaming machines, and random number ticket games such as keno. Gaming machines, such as slot machines and pachinko, are usually played by one player at a time and do not require the involvement of casino employees to play. Random number games are based upon the selection of random numbers, either from a computerized random number generator or from other gaming equipment. Random number games may be played at a table, such as roulette, or through the purchase of paper tickets or cards, such as keno or bingo.

### Gaming machines

• Pachinko
• Slot machine
• Video Lottery Terminal
• Video poker

### Random numbers

• Bingo
• Keno

Casino games generally provide a predictable long-term advantage to the casino, or “house”, while offering the player the possibility of a large short-term payout. Some casino games have a skill element, where the player makes decisions; such games are called “random with a tactical element”. While it is possible through skillful play to minimize the house advantage, it is extremely rare that a player has sufficient skill to completely eliminate his inherent long-term disadvantage (the house edge (HE) or house vigorish) in a casino game. Such a skill set would involve years of training, an extraordinary memory and numeracy, and/or acute visual or even aural observation, as in the case of wheel clocking in roulette or other examples of advantage play.
The player’s disadvantage is a result of the casino not paying winning wagers according to the game’s “true odds”, which are the payouts that would be expected considering the odds of a wager either winning or losing. For example, if a game is played by wagering on the number that would result from the roll of one die, true odds would be 5 times the amount wagered since there is a 1 in 6 chance of any single number appearing, assuming that you get the original amount wagered back. However, the casino may only pay 4 times the amount wagered for a winning wager.
The house edge or vigorish is defined as the casino profit expressed as the percentage of the player’s original bet. (In games such as blackjack or Spanish 21, the final bet may be several times the original bet, if the player double and splits.)
In American roulette, there are two “zeroes” (0, 00) and 36 non-zero numbers (18 red and 18 black). This leads to a higher house edge compared to the European roulette. The chances of a player, who bets 1 unit on red, winning is 18/38 and his chances of losing 1 unit is 20/38. The player’s expected value is EV = (18/38 x 1) + (20/38 x -1) = 18/38 – 20/38 = -2/38 = -5.26%. Therefore, the house edge is 5.26%. After 10 spins, betting 1 unit per spin, the average house profit will be 10 x 1 x 5.26% = 0.53 units. Of course, the casino may not win exactly 53 cents of a unit; this figure is the average casino profit from each player if it had millions of players each betting for 10 spins at 1 unit per spin. European and French roulette wheels have only one “zero” and therefore the house advantage (ignoring the en prison rule) is equal to 1/37 = 2.7%.
Poker has become one of the most popular games played in the casino. It is a game of skill and the only game where the players are competing against each other and not the house. There are several variations of poker that are played in casino card rooms.
The house edge of casino games vary greatly with the game, with some games having as low as 0.3%. Keno can have house edges up to 25%, slot machines having up to 15%, while most Australian Pontoon games have house edges between 0.3% and 0.4%. It’s always important to look for the casino game with the lowest house advantage.
The calculation of the roulette house edge was a trivial exercise; for other games, this is not usually the case. Combinatorial analysis and/or computer simulation is necessary to complete the task.
In games which have a skill element, such as blackjack or Spanish 21, the house edge is defined as the house advantage from optimal play (without the use of advanced techniques such as card counting), on the first hand of the shoe (the container that holds the cards). The set of the optimal plays for all possible hands is known as “basic strategy” and is highly dependent on the specific rules and even the number of decks used. Good blackjack and Spanish 21 games have house edges below 0.5%.
Traditionally, the majority of casinos have refused to reveal the house edge information for their slots games and due to the unknown number of symbols and weightings of the reels, in most cases this is much more difficult to calculate than for other casino games. However, due to some online properties revealing this information and some independent research conducted by Michael Shackleford in the offline sector, this pattern is slowly changing.

### Standard deviation

The luck factor in a casino game is quantified using standard deviations (SD). The standard deviation of a simple game like roulette can be calculated using the binomial distribution. In the binomial distribution, SD = sqrt (npq ), where n = number of rounds played, p = probability of winning, and q = probability of losing. The binomial distribution assumes a result of 1 unit for a win, and 0 units for a loss, rather than -1 units for a loss, which doubles the range of possible outcomes. Furthermore, if we flat bet at 10 units per round instead of 1 unit, the range of possible outcomes increases 10 fold.
SD (Roulette, even-money bet) = 2b sqrt(npq ), where b = flat bet per round, n = number of rounds, p = 18/38, and q = 20/38.
For example, after 10 rounds at 1 unit per round, the standard deviation will be 2 x 1 x sqrt(10 x 18/38 x 20/38) = 3.16 units. After 10 rounds, the expected loss will be 10 x 1 x 5.26% = 0.53. As you can see, standard deviation is many times the magnitude of the expected loss.
The standard deviation for pai gow poker is the lowest out of all common casinos. Many, particularly slots, have extremely high standard deviations. As the size of the potential payouts increase, so does the standard deviation.
As the number of rounds increases, eventually, the expected loss will exceed the standard deviation, many times over. From the formula, we can see the standard deviation is proportional to the square root of the number of rounds played, while the expected loss is proportional to the number of rounds played. As the number of rounds increases, the expected loss increases at a much faster rate. This is why it is impossible for a gambler to win in the long term. It is the high ratio of short-term standard deviation to expected loss that fools gamblers into thinking that they can win.
It is important for a casino to know both the house edge and variance for all of their games. The house edge tells them what kind of profit they will make as percentage of turnover, and the variance tells them how much they need in the way of cash reserves. The mathematicians and computer programmers that do this kind of work are called gaming mathematicians and gaming analysts. Casinos do not have in-house expertise in this field, so outsource their requirements to experts in the gaming analysis field.
Wiki

## The Martingale betting system

A martingale is any of a class of betting strategies that originated from and were popular in 18th century France. The simplest of these strategies was designed for a game in which the gambler wins his stake if a coin comes up heads and loses it if the coin comes up tails. The strategy had the gambler double his bet after every loss, so that the first win would recover all previous losses plus win a profit equal to the original stake. The martingale strategy has been applied to roulette as well, as the probability of hitting either red or black is close to 50%.
Since a gambler with infinite wealth will, almost surely, eventually flip heads, the martingale betting strategy was seen as a sure thing by those who advocated it. None of the gamblers possessed infinite wealth, and the exponential growth of the bets would eventually bankrupt “unlucky” gamblers who chose to use the martingale. The gambler usually wins a small net reward, thus appearing to have a sound strategy. However, the gambler’s expected value does indeed remain zero (or less than zero) because the small probability that he will suffer a catastrophic loss exactly balances with his expected gain. (In a casino, the expected value is negative, due to the house’s edge.) The likelihood of catastrophic loss may not even be very small. The bet size rises exponentially. This, combined with the fact that strings of consecutive losses actually occur more often than common intuition suggests, can bankrupt a gambler quickly.

### Contents

• 1 Intuitive analysis
• 2 Mathematical analysis
• 3 Mathematical analysis of a single round
• 4 Alternative mathematical analysis
• 5 Anti-martingale

### Intuitive analysis

The fundamental reason why all martingale-type betting systems fail is that no amount of information about the results of past bets can be used to predict the results of a future bet with accuracy better than chance. In mathematical terminology, this corresponds to the assumption that the win-loss outcomes of each bet are independent and identically distributed random variables, an assumption which is valid in many realistic situations. It follows from this assumption that the expected value of a series of bets is equal to the sum, over all bets that could potentially occur in the series, of the expected value of a potential bet times the probability that the player will make that bet. In most casino games, the expected value of any individual bet is negative, so the sum of lots of negative numbers is also always going to be negative.
The martingale strategy fails even with unbounded stopping time, as long as there is a limit on earnings or on the bets (which is also true in practice). It is only with unbounded wealth, bets and time that it could be argued that the martingale becomes a winning strategy.

### Mathematical analysis

The impossibility of winning over the long run, given a limit of the size of bets or a limit in the size of one’s bankroll or line of credit, is proven by the optional stopping theorem.

### Mathematical analysis of a single round

Let one round be defined as a sequence of consecutive losses followed by either a win, or bankruptcy of the gambler. After a win, the gambler “resets” and is considered to have started a new round. A continuous sequence of martingale bets can thus be partitioned into a sequence of independent rounds. Following is an analysis of the expected value of one round.
Let q be the probability of losing (e.g. for American double-zero roulette, it is 10/19 for a bet on black or red). Let B be the amount of the initial bet. Let n be the finite number of bets the gambler can afford to lose.
The probability that the gambler will lose all n bets is qn. When all bets lose, the total loss is

∑ i = 1 n B ⋅ 2 i − 1 = B ( 2 n − 1 ) {\displaystyle \sum _{i=1}^{n}B\cdot 2^{i-1}=B(2^{n}-1)}

The probability the gambler does not lose all n bets is 1 − qn. In all other cases, the gambler wins the initial bet (B.) Thus, the expected profit per round is

( 1 − q n ) ⋅ B − q n ⋅ B ( 2 n − 1 ) = B ( 1 − ( 2 q ) n ) {\displaystyle (1-q^{n})\cdot B-q^{n}\cdot B(2^{n}-1)=B(1-(2q)^{n})}

Whenever q > 1/2, the expression 1 − (2q)n < 0 for all n > 0. Thus, for all games where a gambler is more likely to lose than to win any given bet, that gambler is expected to lose money, on average, each round. Increasing the size of wager for each round per the martingale system only serves to increase the average loss.
Suppose a gambler has a 63 unit gambling bankroll. The gambler might bet 1 unit on the first spin. On each loss, the bet is doubled. Thus, taking k as the number of preceding consecutive losses, the player will always bet 2k units.
With a win on any given spin, the gambler will net 1 unit over the total amount wagered to that point. Once this win is achieved, the gambler restarts the system with a 1 unit bet.
With losses on all of the first six spins, the gambler loses a total of 63 units. This exhausts the bankroll and the martingale cannot be continued.
In this example, the probability of losing the entire bankroll and being unable to continue the martingale is equal to the probability of 6 consecutive losses: (10/19)6 = 2.1256%. The probability of winning is equal to 1 minus the probability of losing 6 times: 1 − (10/19)6 = 97.8744%.
The expected amount won is (1 × 0.978744) = 0.978744.
The expected amount lost is (63 × 0.021256)= 1.339118.
Thus, the total expected value for each application of the betting system is (0.978744 − 1.339118) = −0.360374 .
In a unique circumstance, this strategy can make sense. Suppose the gambler possesses exactly 63 units but desperately needs a total of 64. Assuming q > 1/2 (it is a real casino) and he may only place bets at even odds, his best strategy is bold play: at each spin, he should bet the smallest amount such that if he wins he reaches his target immediately, and if he doesn’t have enough for this, he should simply bet everything. Eventually he either goes bust or reaches his target. This strategy gives him a probability of 97.8744% of achieving the goal of winning one unit vs. a 2.1256% chance of losing all 63 units, and that is the best probability possible in this circumstance. However, bold play is not always the optimal strategy for having the biggest possible chance to increase an initial capital to some desired higher amount. If the gambler can bet arbitrarily small amounts at arbitrarily long odds (but still with the same expected loss of 1/19 of the stake at each bet), and can only place one bet at each spin, then there are strategies with above 98% chance of attaining his goal, and these use very timid play unless the gambler is close to losing all his capital, in which case he does switch to extremely bold play.

### Alternative mathematical analysis

The previous analysis calculates expected value, but we can ask another question: what is the chance that one can play a casino game using the martingale strategy, and avoid the losing streak long enough to double one’s bankroll.
As before, this depends on the likelihood of losing 6 roulette spins in a row assuming we are betting red/black or even/odd. Many gamblers believe that the chances of losing 6 in a row are remote, and that with a patient adherence to the strategy they will slowly increase their bankroll.
In reality, the odds of a streak of 6 losses in a row are much higher than many people intuitively believe. Psychological studies have shown that since people know that the odds of losing 6 times in a row out of 6 plays are low, they incorrectly assume that in a longer string of plays the odds are also very low. When people are asked to invent data representing 200 coin tosses, they often do not add streaks of more than 5 because they believe that these streaks are very unlikely. This intuitive belief is sometimes referred to as the representativeness heuristic.

### Anti-martingale

This is also known as the reverse martingale. In a classic martingale betting style, gamblers increase bets after each loss in hopes that an eventual win will recover all previous losses. The anti-martingale approach instead increases bets after wins, while reducing them after a loss. The perception is that the gambler will benefit from a winning streak or a “hot hand”, while reducing losses while “cold” or otherwise having a losing streak. As the single bets are independent from each other (and from the gambler’s expectations), the concept of winning “streaks” is merely an example of gambler’s fallacy, and the anti-martingale strategy fails to make any money. If on the other hand, real-life stock returns are serially correlated (for instance due to economic cycles and delayed reaction to news of larger market participants), “streaks” of wins or losses do happen more often and are longer than those under a purely random process, the anti-martingale strategy could theoretically apply and can be used in trading systems (as trend-following or “doubling up”). (But see also dollar cost averaging.)
Wiki