Modeling distributions from data lies at the heart of statistical pattern recognition.
The Rules of Probability
sum rule
$$ p(X)=\sum_{Y}p(X,Y) $$
product rule
$$ p(X,Y)=p(Y|X)p(X) $$
From the above two rules, together with the symmetry property $p(X,Y)=p(Y,X)$, we obtain Bayes' theorem with
$$ p(Y|X)=\frac{p(X|Y)p(Y)}{\displaystyle\sum_{Z}p(X|Z)p(Z)} $$
We note that $X$ and $Y$ are said to be independent if $p(X,Y)=p(X)p(Y)$.
We wish to consider probabilities with respect to continuous variables. If the probability of a real-valued variable $t$ falling in the interval $(x,x+\delta x)$ is given by $p(x)\delta x$ for $\delta x\rightarrow0$, then $p(x)$ is called the probability density over $x$. The probability that $x$ will lie in an interval $(a,b)$ is given by
$$ p(x\in(a,b))=\int_a^bp(t)\ \text dt $$
The probability density $p(x)$ must satisfy the two conditions
$$ \begin{aligned} p(x)&\geqslant0\\ \int_{-\infty}^\infty p(x)\ \text dx&=1 \end{aligned} $$
Consider a change of variables $x=g(y)$ and a probability density $p_x(x)$ that corresponds to a density $p_y(y)$ with respect to the new variable $y$. Observations falling in the range $(x,x+\delta x)$ will, for small values of $\delta x$, be transformed into the range $(y,y+\delta y)$ (or $(y-\delta y,y)$) where $p_x(x)\delta x\simeq p_y(y)\delta y$. Hence
$$ p_y(y)=p_x(x)\bigg|\frac{\text dx}{\text dy}\bigg|=p_x(g(y))|g^{\prime}(y)| $$
Under a nonlinear change of variable, a probability density transforms differently from a simple function.
The probability that $x$ lies in the interval $(-\infty,z)$ is given by the cumulative distribution function defined by
$$ P(z)=\int_{-\infty}^z p(x)\ \text dx $$
which satisfies $P^{\prime}(x)=p(x)$.
If we have several continuous variables $x_1,\ldots,x_D$, denoted collectively by the vector $\bold x$, then we can define a joint probability density $p(\bold x)=p(x_1,\cdots,x_D)$. This probability density must satisfy
$$ \begin{aligned} p(\bold x)&\geqslant0\\ \int p(\bold x)\ \text d\bold x&=1 \end{aligned} $$