How To Calculate Pdf Of Sum Of Random Variables

Interactive Probability Tool

How to Calculate PDF of Sum of Random Variables

Use this premium calculator to find the probability density function of the sum of two independent random variables. Choose either a Normal + Normal model or a Uniform + Uniform model, enter the parameters, and instantly see the resulting distribution, formulas, and chart.

Convolution-based Chart visualization Normal and Uniform cases Vanilla JavaScript

PDF Sum Calculator

The calculator computes Z = X + Y.

Results will appear here

Choose a model, enter parameters, and click Calculate to compute the PDF of Z = X + Y.

Distribution Plot

The chart shows the resulting density of the sum variable Z. For normal inputs, the result is another normal density. For uniform inputs, the result is a trapezoidal or triangular convolution density.

What this calculator uses

  • For independent continuous random variables: fZ(z) = ∫ fX(x) fY(z – x) dx
  • For independent normals: means add, variances add
  • For independent uniforms: density equals overlap length divided by the rectangle area

Expert Guide: How to Calculate the PDF of the Sum of Random Variables

When you want to calculate the probability density function, or PDF, of the sum of random variables, you are solving one of the most important problems in probability theory, statistics, engineering, data science, finance, and signal processing. If you define a new random variable as Z = X + Y, the natural question becomes: what is the density of Z? In other words, how likely is Z to fall near a particular value? The answer is usually obtained through convolution.

At a high level, the PDF of a sum is not generally found by simply adding the two original PDFs point by point. Instead, you must account for all pairs of values from X and Y that add up to the target value z. That is why the central formula for independent continuous random variables is:

fZ(z) = ∫ fX(x) fY(z – x) dx

This formula says: to compute the density of Z at a point z, scan through every possible x, pair it with y = z – x, multiply the densities, and integrate over all x. If X and Y are independent, that product is valid. If they are not independent, the problem changes and you may need a joint density instead.

Why this matters in practice

Summed random variables appear everywhere. Total waiting time is the sum of two service times. Portfolio return can be modeled as the sum of component returns. Measurement error often combines several independent noise sources. In queueing models, travel-time forecasts, communication systems, and risk analysis, the distribution of a sum is often more important than the distribution of each individual piece.

  • Operations research: total completion time is the sum of stage durations.
  • Finance: aggregate return or aggregate loss is the sum of multiple random components.
  • Engineering: signal plus noise often creates additive models.
  • Statistics: sample means and test statistics are built from sums.
  • Reliability: total stress or total demand may equal several random loads added together.

The core method: convolution

Suppose X and Y are independent continuous random variables with PDFs fX(x) and fY(y). Let Z = X + Y. Then the PDF of Z is:

  1. Define the target relationship: z = x + y.
  2. Rewrite one variable in terms of the other: y = z – x.
  3. Multiply the densities: fX(x) fY(z – x).
  4. Integrate over all x where the densities are nonzero.

That final integration range is often the trickiest part. If both variables have finite support, you must determine exactly when x lies in the support of X and z – x lies in the support of Y. That creates the familiar piecewise shapes seen in sums of uniforms and sums of triangular distributions.

Geometric intuition

There is a very useful geometric way to think about convolution. Imagine sliding one density across the other. At each value of z, you measure how much the two shapes overlap. More overlap means a higher density for the sum at that z. This is especially intuitive for uniform distributions, where the density of the sum becomes proportional to the overlap length of two intervals.

Closed-form shortcut for normal random variables

One of the best-known and most important results in probability is that the sum of independent normal random variables is again normal. If:

X ~ N(mu1, sigma1²) and Y ~ N(mu2, sigma2²), then

Z = X + Y ~ N(mu1 + mu2, sigma1² + sigma2²)

This means two things happen:

  • The means add.
  • The variances add, not the standard deviations.

So if X has mean 2 and standard deviation 1.5, while Y has mean 3 and standard deviation 2, then the sum has mean 5 and variance 1.5² + 2² = 2.25 + 4 = 6.25. The standard deviation of the sum is therefore 2.5.

This result is fundamental in sampling theory, linear models, and error propagation. It is also one of the reasons the normal distribution is so central in applied statistics.

Distribution family Input variables Result for Z = X + Y Key statistic
Normal + Normal Independent N(mu1, sigma1²) and N(mu2, sigma2²) Normal Mean = mu1 + mu2, Variance = sigma1² + sigma2²
Uniform + Uniform Independent U(a, b) and U(c, d) Triangular or trapezoidal piecewise density Support = [a + c, b + d]
Exponential + Exponential Independent exponentials with same rate Gamma/Erlang Shape increases by summation count
Many small independent terms Broad class of finite-variance variables Approximately normal Driven by Central Limit Theorem

How to calculate the sum of two uniform random variables

Uniform distributions are perfect for understanding convolution because the answer is visual and piecewise. Let X ~ U(a, b) and Y ~ U(c, d), independent. Then each density is constant over its interval and zero outside. The sum Z = X + Y has support from a + c to b + d.

The PDF is determined by the overlap length between the interval [a, b] and the shifted interval [z – d, z – c]. The exact formula is:

fZ(z) = length([a, b] ∩ [z – d, z – c]) / ((b – a)(d – c))

If both uniforms have the same width, the shape becomes a symmetric triangle. If the widths differ, the shape becomes a trapezoid. This is a beautiful example of how support geometry controls the resulting PDF.

Example with equal widths

Suppose X ~ U(0, 1) and Y ~ U(0, 1). Then Z = X + Y has support [0, 2] and density:

  • fZ(z) = z for 0 ≤ z ≤ 1
  • fZ(z) = 2 – z for 1 < z ≤ 2
  • fZ(z) = 0 otherwise

This is the classic triangular density. It rises linearly, peaks in the middle, and then falls linearly.

Example with unequal widths

If X ~ U(0, 2) and Y ~ U(1, 4), then Z ranges from 1 to 6. The overlap starts small, then reaches a flat region where the shorter interval is fully contained in the longer shifted interval, then declines again. That is why the chart becomes trapezoidal rather than triangular.

Step-by-step workflow for solving these problems by hand

  1. Confirm independence. The standard convolution formula assumes X and Y are independent.
  2. Write the support. Determine where each input density is nonzero.
  3. Set Z = X + Y. Then write Y = Z – X.
  4. Construct the integrand. Use fX(x)fY(z – x).
  5. Determine the valid x-range. This comes from overlapping supports.
  6. Integrate. Simplify the expression into a clean formula, often piecewise.
  7. Check support and total area. The resulting PDF must be nonnegative and integrate to 1.

Common mistakes to avoid

  • Adding PDFs directly. In general, fZ(z) is not fX(z) + fY(z).
  • Adding standard deviations. For independent normals, variances add, not standard deviations.
  • Ignoring support. Piecewise ranges are crucial for bounded distributions.
  • Forgetting independence. Without independence, convolution is incomplete.
  • Mixing up PDF and CDF. The derivative and integral relationships matter.

How the Central Limit Theorem connects to sums

The Central Limit Theorem explains why sums of many independent random variables often look approximately normal, even when the original variables are not normal. This is one of the deepest reasons the normal distribution appears so often in real-world data. As the number of independent, finite-variance terms grows, the standardized sum tends toward a normal distribution.

That does not mean every finite sum is normal. A sum of two uniforms is not normal. A sum of a few skewed variables may remain visibly skewed. But as the number of components increases, the normal approximation often becomes excellent.

Normal interval around mean Probability mass Interpretation
mu ± 1 sigma 68.27% About two-thirds of outcomes lie within one standard deviation
mu ± 2 sigma 95.45% Almost all outcomes lie within two standard deviations
mu ± 3 sigma 99.73% Nearly all outcomes lie within three standard deviations

These percentages are widely used in process control, quality engineering, and statistical modeling. They help explain why sums driven by many small independent effects are often summarized effectively by a mean and variance alone.

When the variables are not independent

If X and Y are dependent, you need more than the two marginal PDFs. You usually need the joint density fX,Y(x, y). The density of Z = X + Y can then be written by integrating the joint density along the line y = z – x. In practical terms, dependence can greatly change the spread and shape of the sum. Positive dependence tends to increase variance, while negative dependence can reduce it.

Variance formula with dependence

Even before deriving the full PDF, dependence already appears in the variance:

Var(X + Y) = Var(X) + Var(Y) + 2Cov(X, Y)

For independent variables, covariance is zero. For dependent variables, it matters immediately.

How this calculator works

The calculator above implements two high-value cases that cover many textbook and applied scenarios:

  • Independent normals: it computes the resulting mean, variance, standard deviation, and plots the normal density of the sum.
  • Independent uniforms: it computes the exact convolution density using interval overlap and plots the piecewise result over the support [a + c, b + d].

This makes the tool useful both for quick practical calculations and for learning the geometric intuition behind convolution. Students can experiment with symmetric and asymmetric cases, while professionals can use it for fast checks during modeling work.

Recommended authoritative references

If you want a deeper and more rigorous treatment, these sources are excellent starting points:

Final takeaway

To calculate the PDF of the sum of random variables, the standard method is convolution. For independent continuous variables, you multiply one density by the shifted version of the other and integrate. In special families, such as the normal distribution, the answer simplifies dramatically. In bounded families, such as uniforms, the result is often piecewise and depends on support overlap. Once you understand these principles, you can move confidently between theory, numerical computation, and real-world modeling.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top