Sub topic 6
Combining Tasks on a Path: Sum the Means, Sum the Variances
This chapter assumes you can compute a PERT expected duration and a standard deviation for one task. It also assumes you know what a dependency chain and a critical path are, and that you are comfortable with squares and square roots. Here you will combine several task estimates into one estimate for a path, and learn why the two quantities combine by different rules.
The problem: from tasks to a path
A project schedule is rarely one task. A path is a chain of tasks in which each one must finish before the next starts. You estimated each task with three values, and now you need to answer a different question: how long will the whole chain take, and how sure are we?
Two numbers describe each task:
- The expected duration,
(O + 4M + P) / 6. - The variance,
((P - O) / 6)^2, which is the square of the standard deviation.
The rule for a path is short:
- The path's expected duration is the sum of the tasks' expected durations.
- The path's variance is the sum of the tasks' variances.
- The path's standard deviation is the square root of the summed variance.
Step 3 is the one people get wrong. You do not add standard deviations. The sections below explain why.
Why means add
Expected values are linear. The average total of several quantities equals the sum of their averages, whatever their distributions look like and whether or not they are related. If task A averages 4.33 days and task B averages 6 days, a chain of A then B averages 10.33 days.
This property needs no independence assumption. Even if A and B are strongly linked, the expected values still add. Only the spread depends on how the tasks relate to each other.
Why variances add (and standard deviations do not)
Variance measures spread in squared units. For two independent quantities, the variance of the sum is the sum of the variances. This is a standard result in probability. The standard deviation of the sum is therefore:
sigma_path = sqrt(sigma_1^2 + sigma_2^2 + ... + sigma_n^2)
The intuition is that tasks rarely all run long together. If one task overruns, another is likely to finish early, or at least on time. Overruns and underruns partly cancel, so the spread of the total grows more slowly than the sum of the individual spreads.
Adding standard deviations would assume every task overruns by its full amount at the same moment. That is the worst case, not the typical case, and it overstates the uncertainty.
A concrete comparison: two independent tasks each have a standard deviation of 3 days.
- Adding standard deviations gives 6 days.
- Adding variances gives 9 + 9 = 18, and the square root is about 4.24 days.
The difference grows with the number of tasks. Ten tasks of equal spread give a path spread of about 3.2 times one task's spread, not 10 times.
A worked example
Take three tasks on one path, with values in days:
| Task | O | M | P | Expected (O+4M+P)/6 | Std dev (P-O)/6 | Variance |
|---|---|---|---|---|---|---|
| A | 2 | 4 | 8 | 4.33 | 1.00 | 1.00 |
| B | 3 | 5 | 13 | 6.00 | 1.67 | 2.78 |
| C | 1 | 2 | 3 | 2.00 | 0.33 | 0.11 |
| Path | 12.33 | 1.97 | 3.89 |
The calculation for the path row:
- Expected: 4.33 + 6.00 + 2.00 = 12.33 days.
- Variance: 1.00 + 2.78 + 0.11 = 3.89 days squared.
- Standard deviation: the square root of 3.89 is about 1.97 days.
Notice that the path standard deviation (1.97) is smaller than the sum of the task standard deviations (1.00 + 1.67 + 0.33 = 3.00). Notice also that task B contributes most of the variance. Its pessimistic value of 13 is far from its most likely value of 5, so it dominates the uncertainty even though it is not the only long task.
The following diagram shows how the numbers flow through the calculation.
Doing it in code
The function below computes the mean, variance and standard deviation for a path. It is the same arithmetic as the table.
from math import sqrt
def pert_task(o, m, p):
"""Return (expected duration, variance) for one task."""
mean = (o + 4 * m + p) / 6
variance = ((p - o) / 6) ** 2
return mean, variance
def path_estimate(tasks):
"""Return (mean, variance, std_dev) for tasks on one path."""
results = [pert_task(o, m, p) for o, m, p in tasks]
mean = sum(r[0] for r in results)
variance = sum(r[1] for r in results)
return mean, variance, sqrt(variance)
tasks = [(2, 4, 8), (3, 5, 13), (1, 2, 3)]
mean, variance, std_dev = path_estimate(tasks)
print(round(mean, 2), round(variance, 2), round(std_dev, 2)) # 12.33 3.89 1.97To see the difference between the right and wrong rule, compare against the naive sum of standard deviations:
tasks = [(2, 4, 8), (3, 5, 13), (1, 2, 3)]
task_sds = [(p - o) / 6 for o, m, p in tasks]
naive = sum(task_sds)
correct = sum(sd ** 2 for sd in task_sds) ** 0.5
print(round(naive, 2), round(correct, 2)) # 3.0 1.97The naive value of 3.0 is about 52 percent larger than the correct 1.97. Any confidence level you then read from the naive value would be padded without justification.
Reading a result from the path
Once you have a path mean and standard deviation, you can express a duration at a chosen confidence level. The next chapter covers that step in detail. As a preview, the PERT method treats the path total as approximately normally distributed. The 85th percentile of a normal distribution lies about 1.04 standard deviations above the mean.
from statistics import NormalDist
mean, std_dev = 12.33, 1.97
print(round(NormalDist(mean, std_dev).inv_cdf(0.85), 2)) # 14.38So the path is expected to take 12.33 days, and there is roughly an 85 percent chance it finishes within 14.38 days. That is the practical payoff of summing variances. A single sum of means would give only 12.33, which a normal distribution says has about a 50 percent chance of being met.
Why this works: the central limit theorem
Individual PERT tasks follow skewed distributions, because a long pessimistic tail makes the shape lopsided. A sum of several such tasks looks more symmetric and more bell-shaped. This is the central limit theorem, and it is why the normal approximation is reasonable for a path made of enough tasks.
The approximation improves with the number of tasks and degrades with one dominant task. If a single task has most of the variance, as task B does in the example, the path total keeps much of that task's skew. With only three tasks the approximation is serviceable but rough. With fewer than that, or with one task dominating, treat the normal figures as indicative only.
Multiple paths and the critical path
Real schedules have parallel paths that merge. The project finishes when the last of them finishes, so you need an estimate for each path, not only for the one that looks longest.
The standard PERT practice is to compute the mean and variance for the path with the longest expected duration, which is the critical path, and report the project's estimate from that path alone. This is quick but has two problems.
First, the longest path by mean is not always the riskiest path. A path with a slightly shorter mean but a large variance can be more likely to run late.
Second, even if each path is independent, the project's chance of finishing on time is lower than the chance for any single path. All paths must finish in time, not just one.
Here is a second path that runs in parallel with the first, ending at the same milestone.
from math import sqrt
from statistics import NormalDist
def path_estimate(tasks):
mean = sum((o + 4 * m + p) / 6 for o, m, p in tasks)
variance = sum(((p - o) / 6) ** 2 for o, m, p in tasks)
return mean, sqrt(variance)
path_a = [(2, 4, 8), (3, 5, 13), (1, 2, 3)]
path_b = [(5, 6, 7), (4, 6, 8)]
deadline = 13
chances = []
for tasks in (path_a, path_b):
mean, std_dev = path_estimate(tasks)
chances.append(NormalDist(mean, std_dev).cdf(deadline))
print(round(chances[0], 2), round(chances[1], 2), round(chances[0] * chances[1], 2))
# 0.63 0.91 0.58Path A has a mean of 12.33 days and Path B has a mean of 12.0 days, so A is the critical path by expected duration. Path A alone has about a 63 percent chance of finishing within 13 days. Path B alone has about a 91 percent chance, since it is tighter. If the two paths are independent, the chance that both finish within 13 days is the product, about 58 percent.
So the "critical path only" estimate of 63 percent is optimistic. This effect is called merge bias. It grows as more near-critical paths join at one milestone.
Common errors
These mistakes appear often when people combine estimates:
- Adding standard deviations. This overstates the spread. Always add variances, then take the square root once at the end.
- Square-rooting too early. Taking each task's standard deviation, averaging them, and using the result is also wrong. Work in variances until the final step.
- Mixing units. Variance is in days squared. Do not add a variance (3.89) to a mean (12.33) or compare it with a duration.
- Summing tasks that run in parallel. Only tasks in sequence belong on one path. Tasks that run side by side belong on different paths, and the longer one drives the path result.
- Ignoring zero-variance tasks. A fixed-duration task, where O = M = P, has a mean and a variance of zero. It adds its duration to the mean and nothing to the spread. That is correct, and you should not drop it from the mean.
- Treating the path mean as the result. Without the standard deviation, the mean says nothing about how likely a date is.
Edge cases to check
- A single task. The path formulas reduce to the task's own values. Your function should handle one-element lists.
- Many small tasks. Variance tends to shrink relative to the mean as tasks multiply, so the path looks more certain than any single task. This is real if the tasks are independent. It is misleading if they share a cause of delay.
- Highly skewed tasks. PERT's standard deviation of
(P - O) / 6ignores M. Two tasks with the same O and P but different M get the same variance, even though the shapes differ. The path calculation inherits this simplification. - Resources and calendars. The sums assume that durations are working time on a continuous chain. Resource waits and non-working days must be handled in the schedule, not in these formulas.
Summary of the rules
| Quantity | Rule for a path | Needs independence? |
|---|---|---|
| Expected duration | Sum of task expected durations | No |
| Variance | Sum of task variances | Yes |
| Standard deviation | Square root of the summed variance | Yes |
| Probability of finishing by a date | Read from a normal distribution with the path mean and standard deviation | Yes, and an approximation |
Exercise
A path has two independent tasks. Task 1 has O=3, M=6, P=15. Task 2 has O=2, M=4, P=8. Compute the expected duration and standard deviation of the path. Also say how much larger the answer would be if you wrongly added the two task standard deviations.
Show answer
Task 1: mean = (3 + 24 + 15) / 6 = 7.0, std dev = (15 - 3) / 6 = 2.0, variance = 4.0. Task 2: mean = (2 + 16 + 8) / 6 = 4.33, std dev = (8 - 2) / 6 = 1.0, variance = 1.0. Path mean = 7.0 + 4.33 = 11.33 days. Path variance = 4.0 + 1.0 = 5.0, so the path std dev = sqrt(5) = 2.24 days. Adding the standard deviations would give 2.0 + 1.0 = 3.0 days, which is about 34 percent larger than the correct 2.24.
Exercise
A path has the same mean as another path, 20 days. Path X has a standard deviation of 1 day and Path Y has a standard deviation of 4 days. Which path is more likely to finish within 22 days, and why? Is the "longest path by mean" rule enough to tell the two apart?
Show answer
Path X. Its 22-day deadline is 2 standard deviations above the mean (z = 2), so the chance of meeting it is about 97.7 percent. Path Y's deadline is only 0.5 standard deviations above its mean (z = 0.5), so the chance is about 69 percent. The longest-path-by-mean rule cannot tell them apart because both means are 20 days. The standard deviation is what separates a safe path from a risky one, so a path's variance must be reported along with its mean.
Exercise
Why can a project's chance of finishing on time be lower than the chance computed for its critical path alone? Name this effect and state the assumption needed to multiply the path probabilities.
Show answer
The project is finished only when every path into the final milestone is finished, so all paths must meet the deadline, not just the critical one. Each additional near-critical path lowers the combined probability. This is called merge bias. Multiplying the individual path probabilities assumes the paths are independent, meaning they share no tasks, resources or common causes of delay. If they do, the product is not exact and simulation should be used.