# What does the syntax $P(X=n)$ mean?

I'm reading a text book about probability and this syntax $P(X=n)$ keeps resurfacing. I've googled around, but I keep getting results on binomial distributions.

What does $P(X=n)$ mean? Does it mean that a certain value $X$ has a variance of $n$? Does it perchance have something to do with a concept called a "random variable"?

-
Let $X$ be a random variable. Then $P(X=n)$ is the probability that $X$ takes on the value $n$. – André Nicolas Apr 17 '12 at 17:39
$X$ is a random variable, and $P(X=n)$ means the probability that $X$ takes the value $n$. – Johannes Kloos Apr 17 '12 at 17:39
Oh thank you, so X is just some random value out there? Such as a coin flip? – John Hoffman Apr 17 '12 at 17:43
Maybe you could tell us the name of the book that you are reading since it is seems to be unusual in using common notation without any explanation, and also unable to convey the concept of a random variable with any clarity. – Dilip Sarwate Apr 17 '12 at 17:47

You can think of a random variable $X$ as a function that maps events to real numbers, i.e., $X : \Omega \rightarrow \mathbb{R}$. The expression $P(X=n)$ denotes the probability that a random variable $X$ has value $n$. Formally, it is a short form for the probability of the event $\{\omega : X(\omega)=n\}$, i.e., $$P(X=n) = P(\{\omega : X(\omega)=n\}).$$ This is also explained here.
For example, if your events are the outcome of throwing a die, you would write the probability of getting a $3$ as $P(X=3)$.
For example your $X$ could be the number of broken eggs in a packet of $6$. Then $X \in \{0, \dots, 6 \}$ and $P(X = 2) = {6 \choose 2} p^2 (1-p)^{6-2}$ where $p$ is the probability that an egg is broken.