Probabilistic Design and Reliability | Module 4 of 10

Monte Carlo Simulation for Reliability

Monte Carlo is conceptually simple: sample uncertain inputs, run the model, count failures. The engineering discipline is proving that the model and the estimate are good enough.

01

Readiness check

Tick only what you can do closed-notes before using this module for design decisions.

  • Generate or interpret a random sample.
  • Write a Python function for an engineering equation.
  • Compute a sample proportion.
  • Explain why repeated simulations differ.
  • Use a simple analytical case as a benchmark.
0 or 1 weak itemsContinue with this module.
2 weak itemsReview Python arrays in Programming, Module 8.
3 or more weak itemsReview computation in Programming and Computation before continuing.
02

The core idea

Monte Carlo reliability estimates P_f by repeated random trials. The estimate is the failure count divided by sample count, and its uncertainty must be checked.

P_f_hat = failures / NSE(P_f_hat) = sqrt(P_f_hat(1 - P_f_hat) / N)95 percent half-width approx 1.96 SE

Monte Carlo is attractive because it handles nonlinear models, nonnormal variables, and black-box simulations with the same workflow. It is also easy to misuse. A large sample cannot correct a wrong failure model, wrong units, or a missing failure mode. Ordinary Monte Carlo is inefficient for rare events because the expected number of failures is N times P_f. If the target probability is 1e-5, a run of 100000 samples expects only one failure, which is not enough for a stable estimate. Good Monte Carlo work includes a deterministic random seed for reproducibility, vectorized implementation where possible, benchmark checks against analytical cases, convergence plots, confidence intervals, and clear interpretation.

The skill works when: the failure event, units, assumptions, distributions, and checks are visible.
The skill breaks down when: a probability is reported without the mechanical model and evidence boundary.
The concept. Monte Carlo reliability estimates P_f by repeated random trials. The estimate is the failure count divided by sample count, and its uncertainty must be checked.
03

The skills, taught in order

Build the deterministic model first

Write the engineering function and test it on known values before sampling.

Sample with units and distributions

Each random input must carry units, distribution, parameters, and evidence.

Count the defined failure event

The code should implement g(X) <= 0 directly and visibly.

Estimate sampling error

Report a confidence interval or standard error, not only a point estimate.

Recognize rare-event limits

If failures are too few, ordinary Monte Carlo is not enough for design certification.

Engineering connection: use these skills to turn variability into a design decision, not just a plot.

04

Worked example 1: direct Monte Carlo for a shaft in torsion

A solid circular shaft sees torque T normal with mean 550 N m and standard deviation 60 N m. Diameter d is normal with mean 30 mm and standard deviation 0.3 mm. Shear yield strength S is normal with mean 220 MPa and standard deviation 18 MPa. Estimate P_f for tau = 16T/(pi d^3) exceeding 0.58 S.

  1. ProblemA solid circular shaft sees torque T normal with mean 550 N m and standard deviation 60 N m. Diameter d is normal with mean 30 mm and standard deviation 0.3 mm. Shear yield strength S is normal with mean 220 MPa and standard deviation 18 MPa. Estimate P_f for tau = 16T/(pi d^3) exceeding 0.58 S.
  2. AssumptionsInputs are independent. Torque is converted to N mm. Yield criterion is simplified for teaching.
  3. Modeltau = 16T / (pi d^3)capacity = 0.58 Sg = capacity - tau
  4. SolveA direct simulation samples T, d, and S, computes tau and capacity, and counts g <= 0. With a fixed seed and 200000 samples, the estimate should be stable to roughly a few parts in 1000 for moderate probabilities.
  5. CheckVerify units: T in N mm, d in mm, tau in N/mm^2 = MPa. Check nominal tau against capacity before sampling.
  6. ConclusionThe method returns a reproducible estimated failure probability and a sampling half-width.
Result. The method returns a reproducible estimated failure probability and a sampling half-width.
05

Worked example 2: ordinary Monte Carlo and rare events

A failure probability is expected to be about 1e-5. How many failures do you expect in 100000 ordinary Monte Carlo samples? Is that enough?

  1. ProblemA failure probability is expected to be about 1e-5. How many failures do you expect in 100000 ordinary Monte Carlo samples? Is that enough?
  2. AssumptionsEach simulation trial is independent and the model probability is correct.
  3. Modelexpected failures = N P_f
  4. SolveExpected failures = 100000 x 1e-5 = 1. A single expected failure is not enough to estimate a probability reliably.
  5. CheckIf the run returns zero failures, the true probability is not proven to be zero. The sample may simply be too small.
  6. ConclusionOrdinary Monte Carlo is usually inappropriate for very rare failure probabilities unless sample counts are enormous or variance-reduction methods are used.
Result. Ordinary Monte Carlo is usually inappropriate for very rare failure probabilities unless sample counts are enormous or variance-reduction methods are used.
06

Python activity

Engineering question: Run a vectorized shaft reliability simulation and report confidence width.

Assumptions and units: Use the units shown in the code comments. Keep the random seed fixed while learning so the result is reproducible.

from math import pi
from random import Random

rng = Random(11)
n = 200_000
failures = 0

for _ in range(n):
    torque = rng.gauss(550_000.0, 60_000.0)  # N mm
    diameter = rng.gauss(30.0, 0.3)          # mm
    strength = rng.gauss(220.0, 18.0)        # MPa
    tau = 16.0 * torque / (pi * diameter**3)
    capacity = 0.58 * strength
    if capacity - tau <= 0.0:
        failures += 1

pf = failures / n
se = (pf * (1.0 - pf) / n) ** 0.5
print("Pf", pf)
print("95 percent half-width", 1.96 * se)
print("nominal tau MPa", 16.0 * 550_000.0 / (pi * 30.0**3))
print("nominal capacity MPa", 0.58 * 220.0)
Numerical checks: The nominal stress should be below nominal capacity. Report the Monte Carlo confidence half-width next to P_f.
Limitations: The shaft model omits fatigue, stress concentrations, correlation, and manufacturing defects.
07

Misconceptions and diagnostics

MistakeDiagnostic questionCorrection
More Monte Carlo samples always make a wrong model correct.Ask: did the deterministic model pass unit, benchmark, and limiting-case checks?Correct the assumption, then rerun the calculation or rewrite the report.
AI-generated reliability code is valid if it produces a plausible plot.Ask: where are the unit tests and analytical benchmark?Correct the assumption, then rerun the calculation or rewrite the report.
Rare-event probabilities can always be estimated using ordinary Monte Carlo.Ask: how many failures did the simulation actually observe?Correct the assumption, then rerun the calculation or rewrite the report.
A random seed makes a model physically true.Ask: does the seed only make the random sequence reproducible?Correct the assumption, then rerun the calculation or rewrite the report.
08

Practice ladder

Recognize

Name two reasons a Monte Carlo reliability result could be wrong even with one million samples.

Solution guidance

Write the governing equation, state units and assumptions, then compare the answer with the relevant limit state or design decision.

Calculate

If N = 100000 and P_f_hat = 0.02, estimate the standard error.

Solution guidance

Write the governing equation, state units and assumptions, then compare the answer with the relevant limit state or design decision.

Diagnose

A simulation reports zero failures in 20000 samples and concludes P_f = 0. Identify the flaw.

Solution guidance

Write the governing equation, state units and assumptions, then compare the answer with the relevant limit state or design decision.

Design

Plan a convergence check for a Monte Carlo estimate of beam failure probability.

Solution guidance

Write the governing equation, state units and assumptions, then compare the answer with the relevant limit state or design decision.

09

Working with AI, and proving it yourself

Useful AI support

Ask for alternative explanations of terminology, candidate code tests, or a checklist of assumptions to verify.
Ask it to challenge a derivation, then prove the result with units, limiting cases, and an independent calculation.
Do not let AI invent material distributions, fabricate failure data, claim standards compliance, or make final safety decisions.

Portfolio evidence

Create one short reliability note for this module. It must include the engineering question, assumptions, input definitions, equations, calculation, checks, interpretation, and limitations.

Verification required: dimensional analysis, a benchmark case, convergence or sample-size check, and a plain-language residual-risk statement.
10

Retrieval and spaced review

Closed notes. Answer out loud, then reveal.

What is P_f_hat?

The number of simulated failures divided by the number of trials.

Why use a deterministic random seed in examples?

To make the sample and result reproducible.

What does the standard error measure?

Sampling uncertainty of the estimated failure probability.

Why are rare events difficult for ordinary Monte Carlo?

Too few failures are observed unless N is very large.

What must be checked before sampling?

The deterministic model, units, assumptions, and benchmark cases.

TodayFinish the review and first two practice levels.
+1 dayRebuild one worked example from a blank page.
+3 daysChange one assumption and predict the effect.
+7 daysConnect this module to the capstone bracket.
+30 daysReuse the method in a new mechanical component.
11

References and source discipline

This course synthesizes original MechCompass explanations from established reliability engineering sources. Confirm current editions and standards before using them for formal design approval.

Topic in this moduleReference direction
Simulation-based reliability estimationHaldar and Mahadevan, Probability, Reliability, and Statistical Methods in Engineering Design
Monte Carlo statistics and confidence intervalsNIST/SEMATECH Engineering Statistics Handbook
Mechanical reliability simulation contextLe, Reliability-Based Mechanical Design, Volume 1