# How to calculate the probability distribution function (PDF)?

Sorry for the dumb question, I've been struggling with understanding the probability distribution function formula, what does "x" and "d" stand for in the formula , and how to use the formula? I've searched for many sample problems and answers but just couldn't get how did they reach the results, as none gives any step-by-step solutions and instead gives the straight results. Could you show me a detailed process to solve a sample question to help me understand how to use this formula? Thank you so much!!!

First, you may be puzzled about what $$f_X(x)$$ means. It is just the writer's way of saying "the probability distribution function for the random variable $$X$$, evaluated when $$X$$ is $$x$$. Let's give an easy example:

Say that $$X$$ has a range of $$0$$ to $$1$$ and on that range, the pdf is $$2x$$. That is, it is very unlikely that $$x$$ will be near to zero, where the pdf is very small, and the most likely values will be near to $$1$$. In that case, we would say that $$f_x(x) = 2x$$

Now for the "d" in the formula -- actually, that is part of a math notation $$dx$$ which stands for a very tiny change in $$x$$. If you have had some calculus experience, you will be familiar with notations like $$\int_a^b x^2 \, dx = \frac13 (b^3 - a^3)$$ If you have not had any differential calculus experience, you won't understand the notations used when talking about pdf's or cumulative distribution functions.

Finally, let's try to understand the whole equation. It says that the probability that the variate $$X$$ is between $$b$$ and $$a$$ is given (in our example) by $$\int_a^b 2x \, dx$$ where that $$2x$$ is the pdf or $$X$$ at the point $$x$$.

This integral turns out to have value $$\int_a^b 2x \, dx = (b^2-a^2)$$

And you can see that the probability that $$0 \leq X \leq 1$$ is $$1^2 - 0^2 = 1$$ which is comforting -- we knew $$X$$ had to be in that range. What we can learn from this is that not every possible function is usable as a pdf; if we had chosen $$f_X(x) = 3x$$ instead, the "normalization" would be wrong, and that comforting property would not hold true.

As a meatier exercise, what would the probability that $$X \leq \frac12$$ be? Well, $$\left( \frac12 \right)^2 - 0^2 = \frac{1}{4}$$

• Thank you so much Mark for your patient explanation! I got the x and d now. :-) I do not, unfortunately, have any experience with calculus and that's the reason why I did not understand how to use the formula. I've gone through some video tutorials of calculus but unfortunately it's too broad and quite tough to catch. Could you kindly explain me why ∫ba 2xdx=(a2−b2)? – novice May 2 '15 at 22:25

I want to add on to what Mark Fischler wrote, and it'll probably be too long for a comment, so it'll go in an answer.

It may interest you to know that another name for PDF is probability density function, and this alludes to a possibly useful way to think of the PDF. One of the confounding aspects of continuous random variables (such as the amount of rainfall in a given year) as opposed to discrete random variables (such as the number of children in a family) is that the probability of them holding any precise value is, in the ideal case, zero.

For instance, what is the probability of the rainfall in Los Angeles in a given year being precisely $14$ inches? And I mean, really, really precisely, as in $14.000000\ldots$ inches? I think that if you insist on infinite precision, you will agree that the probability must be zero (or, at least, smaller than any positive value that you can name, which is effectively zero).

So what we do, instead, is give the density of the probability. If we say that the probability density at $14$ inches of rain equals $0.1$ per inch, so to speak, then what we mean is that the probability that the rainfall lies within (let's say) a $2$-inch range centered on $14$ inches (i.e., $13$ to $15$ inches) is approximately $2$ inches, times $0.1$ per inch, or a probability of $0.2$.

It won't be exactly $0.2$, because the probability density is not a fixed value, but rather a function of the amount of rainfall, which is why it's called a PDF in the first place. The density might be different when you're talking about a rainfall of $5$ inches, or of $50$ inches, and this variation is represented by making the density a function of a number of inches. Suppose you were to call this function $f(x)$, and you plotted this function on a graph, with inches of rainfall along the $x$-axis, and probability density along the $y$-axis. Then you drew vertical lines at $13$ and $15$ inches. Those lines, and the function $f(x)$, and lastly the $x$-axis combine to "box in" an area. That area represents the probability that the rainfall is somewhere between $13$ and $15$ inches!

Furthermore, if you were to measure the area between the PDF and the $x$-axis (what we often call the "area under the curve"), that area would add up to $1$, which is nothing more than the observation that the total rainfall must equal some value (between $0$ inches and infinite rainfall) with probability $1$—i.e., with complete certainty.

There is an operation in calculus that determines the area under the curve between two vertical lines, called integration. We say that the integral of $f(x)$, from $x = 13$ to $15$ (inches), equals the probability that the rainfall is between $13$ and $15$ inches. This is what that looks like, symbolically (using $X$ to denote rainfall):

$$P(13 \leq X \leq 15) = \int_{x=13}^{15} f(x) \, dx$$

That's all that says. Sometimes, people will write $f_X(x)$, in place of $f(x)$, to emphasize that the function $f(x)$ is a PDF for the random variable $X$. But either way, it is just a function that tells you how densely the probability of rainfall (or whatever you're talking about) is "packed" in the neighborhood of a given value.

Hope that helps.

• Also, it sounds as though you haven't much (if any) experience with integration, if you're not familiar with the $dx$ notation. I'm afraid that goes beyond the scope of this answer. You'll have to find other resources to explain that. But hopefully, this will tell you what the integral represents in this case, at the least. – Brian Tung May 1 '15 at 23:29
• Hi Brian, thank you so much for such detailed and patient explanation for a dumb like me! Feel crying when reading it! and thanks a lot for helping me out many times. Indeed I've no experience with calculus, integration or differentiation, I've watched some video tutorials about calculus and PDF and got an idea of the PDF now. Yet still no idea of the dx notation or how to compute. What I'm studying is not calculus and thus would go a bit too far to learn the whole thing, would you recommend any online resource that I can get a quick idea of the dx notation and the computation of the function? – novice May 7 '15 at 17:57
• This seemed like a relatively painless introduction: mathsisfun.com/calculus/introduction.html – Brian Tung May 7 '15 at 17:59
• At the bottom of the first page are links to differentiation and integration, which are the two fundamental and complementary operations of calculus. – Brian Tung May 7 '15 at 17:59