Latest build deployed.

This commit is contained in:
2026-01-11 13:24:27 -05:00
parent 5f05bd0b9f
commit 63ce1d952b
674 changed files with 4797 additions and 562 deletions
Regular → Executable
+211 -17
View File
@@ -9,7 +9,7 @@
<!--******************************************-->
<!--* Authored with PreTeXt *-->
<!--* pretextbook.org *-->
<!--* Theme: default-modern *-->
<!--* Theme: boulder *-->
<!--* Palette: *-->
<!--******************************************-->
<head xmlns:og="http://ogp.me/ns#" xmlns:book="https://ogp.me/ns/book#">
@@ -101,15 +101,15 @@ eBookConfig.allow_pairs = false;
eBookConfig.enableScratchAC = false;
eBookConfig.build_info = "";
eBookConfig.python3 = null;
eBookConfig.runestone_version = '7.11.5';
eBookConfig.runestone_version = '7.11.8';
eBookConfig.jobehost = '';
eBookConfig.proxyuri_runs = '';
eBookConfig.proxyuri_files = '';
eBookConfig.enable_chatcodes = false;
</script>
<!--*** Runestone Services ***-->
<script src="_static/prefix-runtime.42217a82c75796c8.bundle.js"></script><script src="_static/prefix-723.3e6434f80549315a.bundle.js"></script><script src="_static/prefix-runestone.7e141ad8414abf4a.bundle.js"></script><link rel="stylesheet" type="text/css" href="_static/prefix-723.3bccd435914aa0ff.css">
<link rel="stylesheet" type="text/css" href="_static/prefix-runestone.f4ab138da65f4203.css">
<script src="_static/prefix-runtime.991c135ccf182bf5.bundle.js"></script><script src="_static/prefix-723.3e6434f80549315a.bundle.js"></script><script src="_static/prefix-runestone.1c010553c35c544c.bundle.js"></script><link rel="stylesheet" type="text/css" href="_static/prefix-723.3bccd435914aa0ff.css">
<link rel="stylesheet" type="text/css" href="_static/prefix-runestone.677a75a9120449ff.css">
<script src="_static/pretext/js/lti_iframe_resizer.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.9/lunr.min.js" integrity="sha512-4xUl/d6D6THrAnXAwGajXkoWaeMNwEKK4iNfq5DotEbLPAfk6FSxSP3ydNxqDgCw1c/0Z1Jg6L8h2j+++9BZmg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="lunr-pretext-search-index.js" async=""></script><script src="_static/pretext/js/pretext_search.js"></script><script src="_static/pretext/js/lib/knowl.js"></script><!--knowl.js code controls Sage Cells within knowls--><script>sagecellEvalName='Evaluate (Sage)';
</script>
</head>
@@ -129,7 +129,13 @@ eBookConfig.enable_chatcodes = false;
<ol id="searchresults" class="searchresults"></ol>
</div>
</div>
<span class="nav-other-controls"><button id="light-dark-button" class="light-dark-button button" title="Dark Mode"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe51c;</span><span class="name">Dark Mode</span></button></span><span class="treebuttons"><a class="previous-button button" href="sec-Expected-Value.html" title="Previous"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cb;</span><span class="name">Prev</span></a><a class="up-button button" href="ch-Expected-Value.html" title="Up"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5ce;</span><span class="name">Up</span></a><a class="next-button button" href="sec-Covariance.html" title="Next"><span class="name">Next</span><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cc;</span></a></span>
<span class="nav-other-controls"><button id="embed-button" class="embed-button button" title="Embed this page"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe86f;</span><span class="name">Embed</span></button><div class="embed-popup hidden" id="embed-popup">
<p>Copy the code below to embed this page in your own website or LMS page.</p>
<div class="embed-code-container">
<textarea class="embed-code-textbox" id="embed-code-textbox" readonly aria-label="textbox"><iframe src="https://example.com/embed" width="100%" height="1000"></iframe></textarea><button class="copy-embed-button button" id="copy-embed-button" title="Copy embed code"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe14d;</span><span class="name">Copy</span></button>
</div>
</div>
<button id="light-dark-button" class="light-dark-button button" title="Dark Mode"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe51c;</span><span class="name">Dark Mode</span></button></span><span class="treebuttons"><a class="previous-button button" href="sec-Expected-Value.html" title="Previous"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cb;</span><span class="name">Prev</span></a><a class="up-button button" href="ch-Expected-Value.html" title="Up"><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5ce;</span><span class="name">Up</span></a><a class="next-button button" href="sec-Covariance.html" title="Next"><span class="name">Next</span><span class="icon material-symbols-outlined" aria-hidden="true">&#xe5cc;</span></a></span>
</div></nav><div id="latex-macros" class="hidden-content process-math" style="display:none"><span class="process-math">\(\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
@@ -144,6 +150,7 @@ eBookConfig.enable_chatcodes = false;
\DeclareMathOperator{\E}{E}
\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\Cov}{Cov}
\newcommand{\lt}{&lt;}
\newcommand{\gt}{&gt;}
\newcommand{\amp}{&amp;}
@@ -151,9 +158,13 @@ eBookConfig.enable_chatcodes = false;
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)</span></div>
<div class="ptx-page">
<div id="ptx-sidebar" class="ptx-sidebar"><nav id="ptx-toc" class="ptx-toc depth2 focused" data-preexpanded-levels="0" data-max-levels="2"><ul class="structural toc-item-list contains-active">
<div id="ptx-sidebar" class="ptx-sidebar"><nav id="ptx-toc" class="ptx-toc depth2"><ul class="structural toc-item-list contains-active">
<li class="toc-item toc-frontmatter"><div class="toc-title-box"><a href="frontmatter.html" class="internal"><span class="title">Front Matter</span></a></div></li>
<li class="toc-item toc-chapter">
<div class="toc-title-box"><a href="ch-Introduction.html" class="internal"><span class="codenumber">0</span> <span class="title">Introduction</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-Introduction.html" class="internal"><span class="codenumber">0.1</span> <span class="title">Introduction</span></a></div></li></ul>
</li>
<li class="toc-item toc-chapter">
<div class="toc-title-box"><a href="ch-Probability.html" class="internal"><span class="codenumber">1</span> <span class="title">Probability Theory</span></a></div>
<ul class="structural toc-item-list">
<li class="toc-item toc-section">
@@ -201,6 +212,10 @@ eBookConfig.enable_chatcodes = false;
<li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Continuous-RVs.html#exercises-Continuous-RVs" class="internal"><span class="codenumber">2.2.5</span> <span class="title">Exercises</span></a></div></li>
</ul>
</li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-Joint-Distributions.html" class="internal"><span class="codenumber">2.3</span> <span class="title">Joint Distributions</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Joint-Distributions.html#exercises-Joint-Distributions" class="internal"><span class="codenumber">2.3</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
</ul>
</li>
<li class="toc-item toc-chapter contains-active">
@@ -228,24 +243,48 @@ eBookConfig.enable_chatcodes = false;
<li class="toc-item toc-chapter">
<div class="toc-title-box"><a href="ch-Confidence-Intervals.html" class="internal"><span class="codenumber">4</span> <span class="title">Confidence Intervals</span></a></div>
<ul class="structural toc-item-list">
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-CLT.html" class="internal"><span class="codenumber">4.1</span> <span class="title">Central Limit Theorem</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-Confidence-Intervals.html" class="internal"><span class="codenumber">4.2</span> <span class="title">Confidence Intervals</span></a></div></li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-CLT.html" class="internal"><span class="codenumber">4.1</span> <span class="title">Central Limit Theorem</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-CLT.html#exercises-CLT" class="internal"><span class="codenumber">4.1</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-Confidence-Intervals.html" class="internal"><span class="codenumber">4.2</span> <span class="title">Confidence Intervals</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Confidence-Intervals.html#exercises-Confidence-Intervals" class="internal"><span class="codenumber">4.2</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
</ul>
</li>
<li class="toc-item toc-chapter">
<div class="toc-title-box"><a href="ch-Hypothesis-Testing.html" class="internal"><span class="codenumber">5</span> <span class="title">Hypothesis Testing</span></a></div>
<ul class="structural toc-item-list">
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-One-Sample-Tests.html" class="internal"><span class="codenumber">5.1</span> <span class="title">One Sample Tests</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-Two-Sample-Tests.html" class="internal"><span class="codenumber">5.2</span> <span class="title">Two Sample Tests</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-Power.html" class="internal"><span class="codenumber">5.3</span> <span class="title">Power of a Test</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-Chi-Squared.html" class="internal"><span class="codenumber">5.4</span> <span class="title"><span class="process-math">\(\chi^2\)</span> Test</span></a></div></li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-One-Sample-Tests.html" class="internal"><span class="codenumber">5.1</span> <span class="title">One Sample Tests</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-One-Sample-Tests.html#exercises-One-Sample-Tests" class="internal"><span class="codenumber">5.1</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-Two-Sample-Tests.html" class="internal"><span class="codenumber">5.2</span> <span class="title">Two Sample Tests</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Two-Sample-Tests.html#exercises-Two-Sample-Tests" class="internal"><span class="codenumber">5.2</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-Power.html" class="internal"><span class="codenumber">5.3</span> <span class="title">Power of a Test</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Power.html#exercises-Power" class="internal"><span class="codenumber">5.3</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-Chi-Squared.html" class="internal"><span class="codenumber">5.4</span> <span class="title"><span class="process-math">\(\chi^2\)</span> Test</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Chi-Squared.html#exercises-Chi-Squared" class="internal"><span class="codenumber">5.4</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
</ul>
</li>
<li class="toc-item toc-chapter">
<div class="toc-title-box"><a href="ch-Linear-Regression.html" class="internal"><span class="codenumber">6</span> <span class="title">Linear Regression</span></a></div>
<ul class="structural toc-item-list">
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-Correlation.html" class="internal"><span class="codenumber">6.1</span> <span class="title">Correlation</span></a></div></li>
<li class="toc-item toc-section"><div class="toc-title-box"><a href="sec-Linear-Regression.html" class="internal"><span class="codenumber">6.2</span> <span class="title">Linear Regression</span></a></div></li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-Correlation.html" class="internal"><span class="codenumber">6.1</span> <span class="title">Correlation</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Correlation.html#exercises-Correlation" class="internal"><span class="codenumber">6.1</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
<li class="toc-item toc-section">
<div class="toc-title-box"><a href="sec-Linear-Regression.html" class="internal"><span class="codenumber">6.2</span> <span class="title">Linear Regression</span></a></div>
<ul class="structural toc-item-list"><li class="toc-item toc-exercises"><div class="toc-title-box"><a href="sec-Linear-Regression.html#exercises-Linear-Regression" class="internal"><span class="codenumber">6.2</span> <span class="title">Exercises</span></a></div></li></ul>
</li>
</ul>
</li>
<li class="toc-item toc-backmatter"><div class="toc-title-box"><a href="backmatter.html" class="internal"><span class="title">Backmatter</span></a></div></li>
@@ -253,14 +292,169 @@ eBookConfig.enable_chatcodes = false;
<main class="ptx-main"><div id="ptx-content" class="ptx-content"><section class="section" id="sec-Variance"><h2 class="heading hide-type">
<span class="type">Section</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="title">Variance</span>
</h2>
<div class="para" id="sec-Variance-2">Text of section.<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-2" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
<div class="para" id="sec-Variance-2">The expected value is one of several statistics sometimes referred to as a "measure of central tendency". These are statistics that try to capture the "typical" value of the random variable. Our next statistic tries to measure how spread out a distribution is.<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-2" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<section class="exercises" id="exercises-Variance"><h3 class="heading hide-type">
<article class="definition definition-like" id="def-variance"><h3 class="heading">
<span class="type">Definition</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.1</span><span class="period heading-divison-mark heading-divison-mark__period">.</span>
</h3>
<div class="para logical" id="def-variance-1-1">
<div class="para">Let <span class="process-math">\(X\)</span> be a random variable. The <dfn class="terminology">variance</dfn> of <span class="process-math">\(X\)</span> is:</div>
<div class="displaymath process-math" id="def-variance-1-1-4">
\begin{gather*}
\Var(X) = \E\left[ \left(X - \E(X)\right)^2 \right].
\end{gather*}
</div>
<div class="autopermalink" data-description="Paragraph"><a href="#def-variance-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Definition 3.2.1"><a href="#def-variance" title="Copy heading and permalink for Definition 3.2.1" aria-label="Copy heading and permalink for Definition 3.2.1">🔗</a></div></article><div class="para" id="sec-Variance-4">This formula tries to capture some measure of how spread out the distribution is. One way we might hope to measure spread is to calculate how far away <span class="process-math">\(X\)</span> is from its expected value on average. Squaring the term <span class="process-math">\(X - \E(X)\)</span> ensures that any difference between the value of the random variable and its expected value contributes positively. ("Distance away from" should be positive.) So, the formula in <a href="sec-Variance.html#def-variance" class="xref" data-knowl="./knowl/xref/def-variance.html" data-reveal-label="Reveal" data-close-label="Close" title="Definition 3.2.1">Definition 3.2.1</a> is conceptually clear. In practice, theres another way to structure the formula that makes for cleaner calculation:<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-4" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<article class="theorem theorem-like" id="thm-variance-formula"><h3 class="heading">
<span class="type">Theorem</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.2</span><span class="period heading-divison-mark heading-divison-mark__period">.</span>
</h3>
<div class="para logical" id="thm-variance-formula-1-1">
<div class="para">Let <span class="process-math">\(X\)</span> be a random variable. Then:</div>
<div class="displaymath process-math" id="thm-variance-formula-1-1-2">
\begin{gather*}
\Var(X) = \E\left(X^2\right) - \left(\E(X)\right)^2.
\end{gather*}
</div>
<div class="autopermalink" data-description="Paragraph"><a href="#thm-variance-formula-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Theorem 3.2.2"><a href="#thm-variance-formula" title="Copy heading and permalink for Theorem 3.2.2" aria-label="Copy heading and permalink for Theorem 3.2.2">🔗</a></div></article><details id="sec-Variance-6" class="hiddenproof born-hidden-knowl"><summary class="knowl__link"><h3 class="heading"><span class="type">Proof<span class="period heading-divison-mark heading-divison-mark__period">.</span></span></h3></summary><article class="hiddenproof knowl__content"><div class="para logical" id="sec-Variance-6-1">
<div class="displaymath process-math" id="sec-Variance-6-1-1">
\begin{align*}
\Var(X) \amp = \E\left[ \left(X - \E(X)\right)^2 \right] \\
\amp = \E\left[ X^2 - 2 \E(X) X + \left(\E(X)\right)^2\right] \\
\amp = \E\left(X^2\right) - 2 \E(X) \E(X) + \left(\E(X)\right)^2\\
\amp = \E\left(X^2\right) - \left(\E(X)\right)^2.
\end{align*}
</div>
<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-6-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Proof 3.2.1"><a href="#sec-Variance-6" title="Copy heading and permalink for Proof 3.2.1" aria-label="Copy heading and permalink for Proof 3.2.1">🔗</a></div></article></details><article class="example example-like" id="example-var-die"><h3 class="heading">
<span class="type">Example</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.3</span><span class="period heading-divison-mark heading-divison-mark__period">.</span>
</h3>
<div class="para logical" id="example-var-die-1-1">
<div class="para">Let <span class="process-math">\(R\)</span> be the value of a fair 6-sided die roll. Weve seen in <a href="sec-Expected-Value.html#example-EV-die" class="xref" data-knowl="./knowl/xref/example-EV-die.html" data-reveal-label="Reveal" data-close-label="Close" title="Example 3.1.2">Example 3.1.2</a> that <span class="process-math">\(\E(R) = \frac{7}{2}\text{.}\)</span> To find <span class="process-math">\(\E\left(R^2\right)\text{:}\)</span>
</div>
<div class="displaymath process-math" data-contains-math-knowls="./knowl/xref/example-EV-die.html" id="example-var-die-1-1-5">
\begin{align*}
\E\left(R^2\right) \amp = 1^2 \left(\frac{1}{6}\right) + 2^2 \left(\frac{1}{6}\right) + 3^2 \left(\frac{1}{6}\right) + 4^2 \left(\frac{1}{6}\right) + 5^2 \left(\frac{1}{6}\right) + 6^2 \left(\frac{1}{6}\right) \\
\amp = 1 \left(\frac{1}{6}\right) + 4 \left(\frac{1}{6}\right) + 9 \left(\frac{1}{6}\right) + 16 \left(\frac{1}{6}\right) + 25 \left(\frac{1}{6}\right) + 36 \left(\frac{1}{6}\right) \\
\amp = \frac{91}{6}.
\end{align*}
</div>
<div class="para">Then</div>
<div class="displaymath process-math" data-contains-math-knowls="./knowl/xref/example-EV-die.html" id="example-var-die-1-1-6">
\begin{gather*}
\Var(R) = \E\left(R^2\right) - \left(\E(R)\right)^2 = \frac{91}{6} - \frac{49}{4} = \frac{35}{12}.
\end{gather*}
</div>
<div class="autopermalink" data-description="Paragraph"><a href="#example-var-die-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Example 3.2.3"><a href="#example-var-die" title="Copy heading and permalink for Example 3.2.3" aria-label="Copy heading and permalink for Example 3.2.3">🔗</a></div></article><div class="para" id="sec-Variance-8">Notice that in the <span class="process-math">\(\E\left(R^2\right)\)</span> calculation, were just taking the basic structure of the <span class="process-math">\(\E(R)\)</span> calculation and squaring the <span class="process-math">\(R\)</span> values. The analogous calculation for a continuous random variable looks similar:<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-8" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<article class="example example-like" id="example-uniform-variance"><h3 class="heading">
<span class="type">Example</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.4</span><span class="period heading-divison-mark heading-divison-mark__period">.</span>
</h3>
<div class="para logical" id="example-uniform-variance-1-1">
<div class="para">Let <span class="process-math">\(X\)</span> be uniform on the interval <span class="process-math">\([a, b]\text{.}\)</span> So <span class="process-math">\(X\)</span> has the pdf <span class="process-math">\(f(x) = \frac{1}{b - a}\text{,}\)</span> and we saw in <a href="sec-Expected-Value.html#example-uniform-EV" class="xref" data-knowl="./knowl/xref/example-uniform-EV.html" data-reveal-label="Reveal" data-close-label="Close" title="Example 3.1.7">Example 3.1.7</a> that <span class="process-math">\(\E(X) = \frac{a + b}{2}\text{.}\)</span> Now:</div>
<div class="displaymath process-math" data-contains-math-knowls="./knowl/xref/example-uniform-EV.html" id="example-uniform-variance-1-1-7">
\begin{align*}
\E\left(X^2\right) \amp = \int_a^b x^2 f(x)\ dx \\
\amp = \int_a^b \frac{x^2}{b - a} \ dx \\
\amp = \frac{1}{b-a} \left(\frac{x^3}{3}\right)\bigg|_a^b \\
\amp = \frac{1}{b-a} \left( \frac{b^3}{3} - \frac{a^3}{3} \right) \\
\amp = \frac{1}{b - a}\left( \frac{(b - a)(a^2 + ab + b^2)}{3}\right) \\
\amp = \frac{a^2 + ab + b^2}{3}.
\end{align*}
</div>
<div class="para">Then:</div>
<div class="displaymath process-math" data-contains-math-knowls="./knowl/xref/example-uniform-EV.html" id="example-uniform-variance-1-1-8">
\begin{align*}
\Var(X) \amp = \E\left(X^2\right) - \left(\E(X)\right)^2 \\
\amp = \frac{a^2 + ab + b^2}{3} - \frac{(a+b)^2}{4} \\
\amp = \frac{a^2 + ab + b^2}{3} - \frac{a^2 + 2ab + b^2}{4} \\
\amp = \frac{4a^2 + 4ab + 4b^2}{12} - \frac{3a^2 + 6ab + 3b^2}{12} \\
\amp = \frac{a^2 - 2ab + b^2}{12} \\
\amp = \frac{(a - b)^2}{12}.
\end{align*}
</div>
<div class="autopermalink" data-description="Paragraph"><a href="#example-uniform-variance-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Example 3.2.4"><a href="#example-uniform-variance" title="Copy heading and permalink for Example 3.2.4" aria-label="Copy heading and permalink for Example 3.2.4">🔗</a></div></article><div class="para" id="sec-Variance-10">Variance is <em class="emphasis">not</em> linear. In general, you cant split up variance across plus or minus signs, and you cant pull multiplied constants out of the variance like you can with expected value. However, there are some properties we can use to do similar manipulations to the variance.<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-10" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<article class="theorem theorem-like" id="thm-variance-properties"><h3 class="heading">
<span class="type">Theorem</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.5</span><span class="period heading-divison-mark heading-divison-mark__period">.</span>
</h3>
<div class="para logical" id="thm-variance-properties-1-1">
<div class="para">Let <span class="process-math">\(X\)</span> and <span class="process-math">\(Y\)</span> be random variables, and let <span class="process-math">\(\alpha \in \R\text{.}\)</span> Then:</div>
<ol class="decimal" id="thm-variance-properties-1-1-4">
<li id="thm-variance-properties-1-1-4-1">
<div class="para" id="thm-variance-properties-1-1-4-1-1">
<span class="process-math">\(\Var(X + \alpha) = \Var(X)\text{.}\)</span><div class="autopermalink" data-description="Paragraph"><a href="#thm-variance-properties-1-1-4-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Item 1"><a href="#thm-variance-properties-1-1-4-1" title="Copy heading and permalink for Item 1" aria-label="Copy heading and permalink for Item 1">🔗</a></div>
</li>
<li id="thm-variance-properties-1-1-4-2">
<div class="para" id="thm-variance-properties-1-1-4-2-1">
<span class="process-math">\(\Var(\alpha X) = \alpha^2 \Var(X)\text{.}\)</span><div class="autopermalink" data-description="Paragraph"><a href="#thm-variance-properties-1-1-4-2-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Item 2"><a href="#thm-variance-properties-1-1-4-2" title="Copy heading and permalink for Item 2" aria-label="Copy heading and permalink for Item 2">🔗</a></div>
</li>
<li id="thm-variance-properties-1-1-4-3">
<div class="para" id="thm-variance-properties-1-1-4-3-1">If <span class="process-math">\(X\)</span> and <span class="process-math">\(Y\)</span> are independent, then <span class="process-math">\(\Var(X + Y) = \Var(X) + \Var(Y)\text{.}\)</span><div class="autopermalink" data-description="Paragraph"><a href="#thm-variance-properties-1-1-4-3-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Item 3"><a href="#thm-variance-properties-1-1-4-3" title="Copy heading and permalink for Item 3" aria-label="Copy heading and permalink for Item 3">🔗</a></div>
</li>
</ol>
<div class="autopermalink" data-description="Paragraph"><a href="#thm-variance-properties-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Theorem 3.2.5"><a href="#thm-variance-properties" title="Copy heading and permalink for Theorem 3.2.5" aria-label="Copy heading and permalink for Theorem 3.2.5">🔗</a></div></article><div class="para" id="sec-Variance-12">Well omit the proofs and just casually observe that these are reasonable properties. <span class="process-math">\(X + \alpha\)</span> is a shift of <span class="process-math">\(X\text{,}\)</span> and shifting shouldnt change how spread out the distribution is. <span class="process-math">\(\alpha X\)</span> scaled <span class="process-math">\(X\)</span> by a constant, so it should scale the spread of the distribution by the same constant. But recall that the variance calculation involves squaring; its an indirect measure of spread. So its reasonable that scaling the distribution by a constant should scale the variance by its square.<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-12" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="para" id="sec-Variance-13">Lets put these properties to use in a pair of related examples:<div class="autopermalink" data-description="Paragraph"><a href="#sec-Variance-13" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<article class="example example-like" id="example-indicator-variance"><h3 class="heading">
<span class="type">Example</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.6</span><span class="period heading-divison-mark heading-divison-mark__period">.</span>
</h3>
<div class="para logical" id="example-indicator-variance-1-1">
<div class="para">Let <span class="process-math">\(X\)</span> indicate an event <span class="process-math">\(A\)</span> which has probability <span class="process-math">\(p\text{.}\)</span> In <a href="sec-Expected-Value.html#example-indicator-EV" class="xref" data-knowl="./knowl/xref/example-indicator-EV.html" data-reveal-label="Reveal" data-close-label="Close" title="Example 3.1.5">Example 3.1.5</a>, we saw <span class="process-math">\(\E(X) = p\text{.}\)</span> Notice that <span class="process-math">\(X\)</span> takes the values 0 and 1 (with probabilities <span class="process-math">\(1 - p\)</span> and <span class="process-math">\(p\text{,}\)</span> respectively). But <span class="process-math">\(0^2 = 0\text{,}\)</span> and <span class="process-math">\(1^1 = 1\text{,}\)</span> so the expected value calculation for <span class="process-math">\(X^2\)</span> is precisely the same as for <span class="process-math">\(X\text{!}\)</span>
</div>
<div class="displaymath process-math" data-contains-math-knowls="./knowl/xref/example-indicator-EV.html" id="example-indicator-variance-1-1-13">
\begin{align*}
\E\left(X^2\right) \amp = 0^2 \cdot (1-p) + 1^2 \cdot p = p.
\end{align*}
</div>
<div class="para">So:</div>
<div class="displaymath process-math" data-contains-math-knowls="./knowl/xref/example-indicator-EV.html" id="example-indicator-variance-1-1-14">
\begin{align*}
\Var(X) \amp \E\left(X^2\right) - \left(\E(X)\right)^2 = p - p^2 = p(1 - p).
\end{align*}
</div>
<div class="autopermalink" data-description="Paragraph"><a href="#example-indicator-variance-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Example 3.2.6"><a href="#example-indicator-variance" title="Copy heading and permalink for Example 3.2.6" aria-label="Copy heading and permalink for Example 3.2.6">🔗</a></div></article><article class="example example-like" id="example-binomial-variance"><h3 class="heading">
<span class="type">Example</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.7</span><span class="period heading-divison-mark heading-divison-mark__period">.</span>
</h3>
<div class="para logical" id="example-binomial-variance-1-1">
<div class="para">Recall the setup from <a href="sec-Expected-Value.html#example-binomial-EV" class="xref" data-knowl="./knowl/xref/example-binomial-EV.html" data-reveal-label="Reveal" data-close-label="Close" title="Example 3.1.11">Example 3.1.11</a>: a binomial random variable <span class="process-math">\(S\)</span> is the sum <span class="process-math">\(H_1 + H_2 + \dotsb + H_n\)</span> of <span class="process-math">\(n\)</span> indicator random variables, each with parameter <span class="process-math">\(p\text{.}\)</span> The results of different coin flips are independent from each other, so the random variables <span class="process-math">\(H_1, \dotsc, H_n\)</span> are independent from each other. From <a href="sec-Variance.html#example-indicator-variance" class="xref" data-knowl="./knowl/xref/example-indicator-variance.html" data-reveal-label="Reveal" data-close-label="Close" title="Example 3.2.6">Example 3.2.6</a>, we know that <span class="process-math">\(\Var(H_i) = p(1-p)\)</span> for each <span class="process-math">\(i\text{.}\)</span> Therefore:</div>
<div class="displaymath process-math" data-contains-math-knowls="./knowl/xref/example-binomial-EV.html ./knowl/xref/example-indicator-variance.html" id="example-binomial-variance-1-1-10">
\begin{align*}
\Var(S) \amp = \Var(H_1 + H_2 + \dotsb + H_n) \\
\amp = \Var(H_1) + \Var(H_2) + \dotsb + \Var(H_n) \\
\amp = \underbrace{p(1-p) + p(1-p) + \dotsb + p(1-p)}_{n \text{ times}} \\
\amp = np(1-p).
\end{align*}
</div>
<div class="para">Remember this formula! Well make frequent use of it.</div>
<div class="autopermalink" data-description="Paragraph"><a href="#example-binomial-variance-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
<div class="autopermalink" data-description="Example 3.2.7"><a href="#example-binomial-variance" title="Copy heading and permalink for Example 3.2.7" aria-label="Copy heading and permalink for Example 3.2.7">🔗</a></div></article><section class="exercises" id="exercises-Variance"><h3 class="heading hide-type">
<span class="type">Exercises</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber"></span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="title">Exercises</span>
</h3>
<article class="exercise exercise-like" id="exercises-Variance-1"><h4 class="heading"><span class="codenumber">1<span class="period heading-divison-mark heading-divison-mark__period">.</span></span></h4>
<div class="para" id="exercises-Variance-1-1-1">Consider a random variable <span class="process-math">\(X\)</span> with probability distribution below. Find <span class="process-math">\(\Var(X)\text{.}\)</span><div class="autopermalink" data-description="Paragraph"><a href="#exercises-Variance-1-1-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div> <figure class="table table-like" id="exercises-Variance-1-1-2"><figcaption><span class="type">Table</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.1<span class="period heading-divison-mark heading-divison-mark__period">.</span></span><span class="space heading-divison-mark heading-divison-mark__space"> </span><div class="autopermalink" data-description="Table 3.2.1: "><a href="#exercises-Variance-1-1-2" title="Copy heading and permalink for Table 3.2.1: " aria-label="Copy heading and permalink for Table 3.2.1: ">🔗</a></div></figcaption><div class="tabular-box natural-width"><table class="tabular">
</div> <figure class="table table-like" id="exercises-Variance-1-1-2"><figcaption><span class="type">Table</span><span class="space heading-divison-mark heading-divison-mark__space"> </span><span class="codenumber">3.2.8<span class="period heading-divison-mark heading-divison-mark__period">.</span></span><span class="space heading-divison-mark heading-divison-mark__space"> </span><div class="autopermalink" data-description="Table 3.2.8: "><a href="#exercises-Variance-1-1-2" title="Copy heading and permalink for Table 3.2.8: " aria-label="Copy heading and permalink for Table 3.2.8: ">🔗</a></div></figcaption><div class="tabular-box natural-width"><table class="tabular">
<tr class="header-horizontal">
<th scope="col" class="c m b1 r0 l0 t0 lines"><span class="process-math">\(x\)</span></th>
<th scope="col" class="c m b1 r0 l0 t0 lines"><span class="process-math">\(\Pr(X = x)\)</span></th>