{"id":2518,"date":"2026-02-02T09:47:46","date_gmt":"2026-02-02T09:47:46","guid":{"rendered":"https:\/\/demo.materiamedica.net\/demo6\/?p=2518"},"modified":"2026-02-02T09:47:46","modified_gmt":"2026-02-02T09:47:46","slug":"chapter-11-exponential-distribution","status":"publish","type":"post","link":"https:\/\/demo.materiamedica.net\/demo6\/chapter-11-exponential-distribution\/","title":{"rendered":"Chapter 11: Exponential Distribution"},"content":{"rendered":"<h3 dir=\"auto\">1. What is the exponential distribution really?<\/h3>\n<p dir=\"auto\">The <strong>exponential distribution<\/strong> describes the <strong>time between successive independent events<\/strong> in a <strong>Poisson process<\/strong>.<\/p>\n<p dir=\"auto\">In other words:<\/p>\n<blockquote dir=\"auto\">\n<p dir=\"auto\">If events occur continuously and independently at a constant average rate, then the waiting time until the <strong>next<\/strong> event follows an exponential distribution.<\/p>\n<\/blockquote>\n<p dir=\"auto\">This is one of the most important distributions in <strong>reliability<\/strong>, <strong>queueing<\/strong>, <strong>survival analysis<\/strong>, <strong>telecommunications<\/strong>, <strong>finance<\/strong> (time between trades), and <strong>natural phenomena<\/strong>.<\/p>\n<p dir=\"auto\"><strong>Key intuition<\/strong> (memorize this sentence):<\/p>\n<blockquote dir=\"auto\">\n<p dir=\"auto\">The exponential distribution is <strong>memoryless<\/strong> \u2014 the probability that you have to wait another t minutes for the next event is the same no matter how long you have already waited.<\/p>\n<\/blockquote>\n<p dir=\"auto\">This memoryless property is very unusual and only shared by the exponential (continuous) and geometric (discrete) distributions.<\/p>\n<h3 dir=\"auto\">2. The two most important parameters<\/h3>\n<p dir=\"auto\">There are two common ways to parameterize it \u2014 both are used in practice:<\/p>\n<div>\n<div dir=\"auto\">\n<table dir=\"auto\">\n<thead>\n<tr>\n<th data-col-size=\"lg\">Parameterization<\/th>\n<th data-col-size=\"md\">Parameter name<\/th>\n<th data-col-size=\"xl\">Meaning<\/th>\n<th data-col-size=\"xs\">Typical notation<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td data-col-size=\"lg\">Rate parameterization<\/td>\n<td data-col-size=\"md\">\u03bb (lambda)<\/td>\n<td data-col-size=\"xl\">average rate of events per unit time<\/td>\n<td data-col-size=\"xs\">\u03bb &gt; 0<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"lg\">Scale parameterization<\/td>\n<td data-col-size=\"md\">\u03b2 (beta)<\/td>\n<td data-col-size=\"xl\">average waiting time between events<\/td>\n<td data-col-size=\"xs\">\u03b2 = 1\/\u03bb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><\/div>\n<\/div>\n<\/div>\n<p dir=\"auto\">Relationship: <strong>\u03b2 = 1\/\u03bb<\/strong> <strong>\u03bb = 1\/\u03b2<\/strong><\/p>\n<p dir=\"auto\"><strong>Mean<\/strong> (expected waiting time) = <strong>\u03b2 = 1\/\u03bb<\/strong> <strong>Variance<\/strong> = <strong>\u03b2\u00b2 = 1\/\u03bb\u00b2<\/strong> <strong>Standard deviation<\/strong> = <strong>\u03b2 = 1\/\u03bb<\/strong><\/p>\n<h3 dir=\"auto\">3. Generating exponential random numbers in NumPy<\/h3>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>Python<\/div>\n<div>\n<pre tabindex=\"0\"><code># Using scale parameter (\u03b2 = mean waiting time)\r\n# Example: average 5 minutes between customer arrivals\r\nwaiting_times = np.random.exponential(scale=5, size=50000)\r\n\r\nprint(\"First 10 waiting times (minutes):\", waiting_times[:10].round(2))\r\nprint(\"Average waiting time:\", waiting_times.mean().round(2))\r\nprint(\"Theoretical mean:\", 5)\r\nprint(\"Standard deviation:\", waiting_times.std().round(2))\r\nprint(\"Theoretical std:\", 5)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p dir=\"auto\">Alternative (using rate \u03bb):<\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>Python<\/div>\n<div>\n<pre tabindex=\"0\"><code>lambda_rate = 0.2           # 0.2 customers per minute \u2192 mean = 5 minutes\r\nwaiting_times_rate = np.random.exponential(scale=1\/lambda_rate, size=50000)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 dir=\"auto\">4. Visualizing the exponential distribution (very important)<\/h3>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>Python<\/div>\n<div>\n<pre tabindex=\"0\"><code>fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 5.5))\r\n\r\n# Different mean waiting times\r\nfor mean_time in [2, 5, 12, 30]:\r\n    data = np.random.exponential(scale=mean_time, size=60000)\r\n    \r\n    sns.kdeplot(data, label=f\"mean = {mean_time}\", linewidth=2.3, alpha=0.85)\r\n\r\nax1.set_title(\"Density \u2013 Exponential with different means\", fontsize=13)\r\nax1.set_xlabel(\"Waiting time\", fontsize=11)\r\nax1.set_ylabel(\"Density\", fontsize=11)\r\nax1.set_xlim(0, 80)\r\nax1.legend(title=\"Mean waiting time \u03b2\")\r\n\r\n# Log scale to show tail behavior\r\nx = np.linspace(0.01, 80, 1000)\r\nfor mean in [2, 5, 12, 30]:\r\n    ax2.semilogy(x, stats.expon.pdf(x, scale=mean), lw=2.2, label=f\"mean = {mean}\")\r\n\r\nax2.set_title(\"Log-scale density \u2013 heavy right tail\", fontsize=13)\r\nax2.set_xlabel(\"Waiting time (log view)\", fontsize=11)\r\nax2.set_ylabel(\"Density (log scale)\", fontsize=11)\r\nax2.legend(title=\"Mean waiting time \u03b2\")\r\n\r\nplt.tight_layout()\r\nplt.show()<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p dir=\"auto\"><strong>What you should always notice<\/strong>:<\/p>\n<ul dir=\"auto\">\n<li>Always <strong>right-skewed<\/strong> \u2014 long tail to the right<\/li>\n<li>Never negative values<\/li>\n<li>Starts at maximum density at x=0<\/li>\n<li>Larger mean \u2192 flatter and more stretched out<\/li>\n<li>On log scale \u2192 perfectly straight line downward (unique property of exponential)<\/li>\n<\/ul>\n<h3 dir=\"auto\">5. The memoryless property \u2013 the most famous &amp; important feature<\/h3>\n<p dir=\"auto\"><strong>Mathematical statement<\/strong>:<\/p>\n<p dir=\"auto\">P(T &gt; t + s | T &gt; s) = P(T &gt; t)<\/p>\n<p dir=\"auto\">Translation:<\/p>\n<blockquote dir=\"auto\">\n<p dir=\"auto\">The probability that you still have to wait more than t minutes is the same whether you have already waited s minutes or not.<\/p>\n<\/blockquote>\n<p dir=\"auto\"><strong>Real-life interpretation<\/strong>:<\/p>\n<ul dir=\"auto\">\n<li>If a machine has already run for 1000 hours without breaking, the probability it breaks in the next hour is the <strong>same<\/strong> as if it was brand new.<\/li>\n<li>If no customer arrived in the last 30 minutes, the expected time until the next customer is still the same as always.<\/li>\n<\/ul>\n<p dir=\"auto\"><strong>Quick code demonstration<\/strong><\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>Python<\/div>\n<div>\n<pre tabindex=\"0\"><code>beta = 8  # mean waiting time = 8 minutes\r\n\r\n# Probability of waiting &gt; 15 minutes (from start)\r\np_from_start = np.mean(np.random.exponential(beta, 100000) &gt; 15)\r\n\r\n# Probability of waiting &gt; 15 more minutes after already waiting 20 minutes\r\n# (we simulate by adding 20 to already long waits)\r\nlong_waits = np.random.exponential(beta, 100000)\r\np_from_20 = np.mean(long_waits[long_waits &gt; 20] - 20 &gt; 15)\r\n\r\nprint(f\"P(wait &gt; 15 min from start)  \u2248 {p_from_start:.4f}\")\r\nprint(f\"P(wait &gt; 15 more min after 20 min) \u2248 {p_from_20:.4f}\")<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p dir=\"auto\">Both numbers should be very close \u2192 memoryless.<\/p>\n<h3 dir=\"auto\">6. Real-world examples you will actually meet<\/h3>\n<div>\n<div dir=\"auto\">\n<table dir=\"auto\">\n<thead>\n<tr>\n<th data-col-size=\"md\">Domain<\/th>\n<th data-col-size=\"lg\">Typical use of exponential distribution<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td data-col-size=\"md\">Reliability engineering<\/td>\n<td data-col-size=\"lg\">Time to failure of components (assuming constant hazard rate)<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Queueing theory<\/td>\n<td data-col-size=\"lg\">Time between customer arrivals (when arrival is Poisson)<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Survival analysis<\/td>\n<td data-col-size=\"lg\">Time to event (death, churn, failure, recovery\u2026)<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Telecommunications<\/td>\n<td data-col-size=\"lg\">Time between packet arrivals \/ call arrivals<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Finance<\/td>\n<td data-col-size=\"lg\">Time between trades or price jumps (in some models)<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Natural phenomena<\/td>\n<td data-col-size=\"lg\">Time between earthquakes, lightning strikes, neuron firings<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Service systems<\/td>\n<td data-col-size=\"lg\">Service time \/ processing time (if memoryless)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><\/div>\n<\/div>\n<\/div>\n<h3 dir=\"auto\">7. Realistic code patterns you will use<\/h3>\n<p dir=\"auto\"><strong>Pattern 1 \u2013 Simulate time between events<\/strong><\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>Python<\/div>\n<div>\n<pre tabindex=\"0\"><code># Average 3.5 customers per minute \u2192 mean inter-arrival = 1\/3.5 \u2248 0.286 min\r\ninter_arrivals = np.random.exponential(scale=1\/3.5, size=10000)\r\n\r\narrival_times = np.cumsum(inter_arrivals)\r\n\r\nprint(\"Time of first 8 arrivals (minutes):\", arrival_times[:8].round(3))\r\nprint(\"Average inter-arrival time:\", inter_arrivals.mean().round(4))<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p dir=\"auto\"><strong>Pattern 2 \u2013 Time to failure simulation<\/strong><\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>Python<\/div>\n<div>\n<pre tabindex=\"0\"><code># Component with mean lifetime 1200 hours\r\nlifetimes = np.random.exponential(scale=1200, size=5000)\r\n\r\nprint(\"Probability of failing within first 500 hours:\", np.mean(lifetimes &lt;= 500).round(4))\r\nprint(\"Median lifetime:\", np.median(lifetimes).round(1))<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p dir=\"auto\"><strong>Pattern 3 \u2013 Exponential CDF (probability of waiting less than t)<\/strong><\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>Python<\/div>\n<div>\n<pre tabindex=\"0\"><code>t_values = np.linspace(0, 40, 1000)\r\nbeta = 6\r\n\r\nprob_less_than_t = 1 - np.exp(-t_values \/ beta)\r\n\r\nplt.plot(t_values, prob_less_than_t, lw=2.8, color=\"teal\")\r\nplt.title(f\"CDF \u2013 Exponential (mean waiting time = {beta} min)\")\r\nplt.xlabel(\"Waiting time (min)\")\r\nplt.ylabel(\"P(wait \u2264 t)\")\r\nplt.axvline(beta, color=\"darkred\", ls=\"--\", label=f\"mean = {beta}\")\r\nplt.legend()\r\nplt.show()<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 dir=\"auto\">Summary \u2013 Exponential Distribution Quick Reference<\/h3>\n<div>\n<div dir=\"auto\">\n<table dir=\"auto\">\n<thead>\n<tr>\n<th data-col-size=\"md\">Property<\/th>\n<th data-col-size=\"lg\">Value \/ Formula<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td data-col-size=\"md\">Shape<\/td>\n<td data-col-size=\"lg\">Right-skewed, decays exponentially<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Defined by<\/td>\n<td data-col-size=\"lg\">rate \u03bb or scale \u03b2 = 1\/\u03bb<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Mean<\/td>\n<td data-col-size=\"lg\">\u03b2 = 1\/\u03bb<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Variance<\/td>\n<td data-col-size=\"lg\">\u03b2\u00b2 = 1\/\u03bb\u00b2<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Standard deviation<\/td>\n<td data-col-size=\"lg\">\u03b2 = 1\/\u03bb<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Memoryless property<\/td>\n<td data-col-size=\"lg\">Yes \u2014 unique among continuous distributions<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">PDF<\/td>\n<td data-col-size=\"lg\">\u03bb exp(-\u03bbx) for x \u2265 0<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">CDF<\/td>\n<td data-col-size=\"lg\">1 \u2212 exp(-\u03bbx) for x \u2265 0<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">NumPy function<\/td>\n<td data-col-size=\"lg\">np.random.exponential(scale=\u03b2, size=&#8230;)<\/td>\n<\/tr>\n<tr>\n<td data-col-size=\"md\">Most common use cases<\/td>\n<td data-col-size=\"lg\">time between Poisson events, time to failure, inter-arrival times, service times<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><\/div>\n<\/div>\n<\/div>\n<h3 dir=\"auto\">Final teacher messages<\/h3>\n<ol dir=\"auto\">\n<li><strong>Whenever you are modeling \u201ctime until the next event\u201d<\/strong> and the events follow a Poisson process \u2192 use exponential.<\/li>\n<li><strong>Exponential is the only continuous memoryless distribution<\/strong> \u2014 very powerful and very unusual property.<\/li>\n<li><strong>Exponential + Poisson are twins<\/strong>:\n<ul dir=\"auto\">\n<li>Poisson counts events in fixed interval<\/li>\n<li>Exponential measures time between events<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p dir=\"auto\">Would you like to continue with any of these next?<\/p>\n<ul dir=\"auto\">\n<li>Deep dive into memoryless property with more examples<\/li>\n<li>Exponential vs Weibull (when hazard rate is not constant)<\/li>\n<li>Relationship between exponential and gamma distribution<\/li>\n<li>Realistic mini-project: simulate a queue \/ call center<\/li>\n<li>How to estimate \u03bb from real data<\/li>\n<\/ul>\n<p dir=\"auto\">Just tell me what you want to explore next! \ud83d\ude0a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. What is the exponential distribution really? The exponential distribution describes the time between successive independent events in a Poisson process. In other words: If events occur continuously and independently at a constant average&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[],"class_list":["post-2518","post","type-post","status-publish","format-standard","hentry","category-numpy"],"_links":{"self":[{"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/posts\/2518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/comments?post=2518"}],"version-history":[{"count":1,"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/posts\/2518\/revisions"}],"predecessor-version":[{"id":2519,"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/posts\/2518\/revisions\/2519"}],"wp:attachment":[{"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/media?parent=2518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/categories?post=2518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demo.materiamedica.net\/demo6\/wp-json\/wp\/v2\/tags?post=2518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}