Large deviations theory
In Probability Theory, the Large Deviations Theory concerns the asymptotic behaviour of remote tails of sequences of probability distributions. Some basic ideas of the theory can be tracked back to Laplace and Cramer, although a clear unified formal definition was introduced in 1966 by Varadhan. Large Deviations Theory formalizes the heuristic ideas of concentration of measures and widely generalizes the notion of convergence of probability measures.
Roughly speaking, Large Deviation Theory concerns itself with the exponential decay of the probability measures of certain kinds of extreme or tail events, as the number of observations grows arbitrarily large.

# Introductory examples

## An elementary example
Consider a sequence of independent tosses of a fair
coin. The possible outcomes could be head or tail. Let us denote the possible outcome of the i-th trial by
 X_i , where we encode head as -1 and tail as 1. Now let   M_N    denote the mean value after  N  trials, namely
Then  M_N  lies between -1 and 1.  From the law of large numbers (and also
from our experience) we know that as N become larger and larger,  M_N  becomes 
closer and closer to  0  with increasing probability. Let us make this statement more precise. For a given value  x>0 , let us compute the probability   P(M_N > x)  that
 M_N  is greater than  x . By Chebyshev's inequality it can be shown that 
 P(M_N > x) . This bound is rather sharp, in a suitable technical sense.
In other words the probability  P(M_N > x)  is decaying exponentially rapidly as N grows large, at a rate depending on x.

## Large Deviations for sums of independent random variables
In the above mentioned example of coin-tossing we tacitly assumed that each toss is an 
independent trial. And for each toss, the probability of getting head or tail is always the
same. This makes the random number  X_i  independent and identically distributed (i.i.d.). For i.i.d. variables
whose common distribution satisfies a certain growth condition, large deviation theory states that the following limit exists:
\lim_{N\to \infty} \frac{1}{N} \log P(M_N > x) = - I(x) 
The function  I(x)  is called the "rate function" or "Cramer function" or sometimes the "entropy function". Roughly speaking, the existence of this limit is what establishes the above mentioned exponential decay and allows us to conclude that for large N,
 P(M_N >x)  takes the form:
 P(M_N >x) \approx \exp.
which is the basic result of Large Deviations Theory in this setting. Note that the inequality given in the first paragraph, as opposed to the asymptotic formula presented here, requires an additional argument.
If we know the probability distribution of  X_i , an explicit 
expression for the rate function can be obtained. This is given by a 
Legendre transform
I(x) = \sup_{\theta > 0} 
where the function  \lambda(\theta)  is called the "Cumulant Generating
Function (CGF)", given by
 \lambda(\theta) = \log E 
Here  E  denotes expectation value with respect to the probability 
distribution function of  X_i  and  X  is any one of 
 X_i s. If  X_i  follows a Gaussian distribution,
the rate function becomes a parabola with its apex at the mean of the Gaussian
distribution.
If the condition of Independent Identical Distribution is relaxed, particularly 
if the numbers X_i are not independent but nevertheless 
satisfies Markov Property, the basic large deviations result stated above can be generalized.

# Formal Definition
Given a Polish space X let \{ \mathbb{P}_N\} be a sequence of Borel probability measures on X, let \{a_N\} be a sequence of positive real numbers such that \lim_N a_N=+\infty, and finally let I:X\to  be a lower semicontinuous functional on X. The sequence  \{ \mathbb{P}_N\} is said to satisfy a Large Deviations Principle with speed \{a_n\} and rate I, iff for each Borel measurable set E \subset X
where \bar{E} and E^\circ denote respectively the closure and interior of E.

# Brief History
The first rigorous results concerning Large Deviations are due to the Swedish mathematician 
Harald Cramer, who applied them to model the insurance business.  From the point
-f view of an insurance company, the earning is at a constant rate per month
(the monthly premium) but the claims come randomly. For the company to be successful 
-ver a certain period of time (preferably many months), the total earning should
exceed the total claim. Thus to estimate the premium you have to ask the following
question : "What should we choose as the premium  q  such that over
 N  months the total claim  C = \Sigma X_i  should
be less than  Nq  ? "  This is clearly the same question asked by 
the large deviations theory. Cramer gave a solution to this question for i.i.d. gaussian random variables, where the rate function is expressed as a power series.
The results we have quoted above were later obtained by H. Chernoff, among other people. A very 
incomplete list of mathematicians who have made important advances would 
include S.R.S. Varadhan (who has won the Abel prize), D. Ruelle and O.E. Landford.

# Applications
Establishing Large Deviations Principles is one of the most effective ways to gather information out of a probabilistic model. Some of the best known applications of Large Deviation Theory rise in Statistical Mechanics, Quantum Mechanics, Information Theory and Risk Management.

## Applications to Statistical Mechanics: Large Deviation and Entropy
The rate function is related to the entropy in statistical mechanics. This can be heuristically seen
in the following way. In statistical mechanics the entropy of a particular macro-state is related
to the number of micro-states which corresponds to this macro-state. In our coin tossing example the
mean value  M_N  could designate a particular macro-state. And the particular sequence of
heads and tails which gives rise to a particular value of  M_N  constitutes a particular
micro-state. Loosely speaking a macro-state having more number of micro-states giving rise to it,
has higher entropy. And a state with higher entropy has more chance of being realised in actual
experiments. The macro-state with mean value of half has the highest number micro-states giving
rise to it and it is indeed the state with the highest entropy. And in most practical situation
we shall indeed obtain this macro-state for large number of trials. The "rate function" on the other
hand measures the probability of appearance of a particular macro-state. The smaller the rate function
the higher is the chance of a macro-state appearing. In our coin-tossing the value of the "rate function" for mean value
equal to half is zero. In this way one can see the "rate  function" as the negative of the "entropy".