Class 41
Between Class Sessions - Prep for Day 41
Please spend around 2 hours working between class sessions, focusing on the tasks below. Use any extra time to complete KnewtonAlta assignments and/or work on Project tasks.
Pick something from your prep today that you can share with your group in class. It might be something new that you learned. It might be questions you have that are still unanswered, or a question along with what helped you eventually answer it. It might be something tricky that you solved. It might be a review topic that helped you remember something. It might be a conversation you had with AI that was helpful. You will have a chance to share this with your peers during class. Come ready to articulate your thinking and questions.
Preparation
(1) Making Connections
- Prepare to share just a few problems from 3 – Compute Probability (Continuous Random Variables) and Complete 3 – Calculate Parameters of Continuous Random Variables Identifying Expected Value and Variance assignments in Knewton Alta.
- Write down the definite integrals then use Mathematica to compute the integrals.
- What connections can you identify between the exercises in these assignments and our in-class exercises?
- What connections can you find between these exercises and Project 3?
(2) Definite Integrals and Geometric arguments
- Consider the function \(f(x) = \sqrt{16-(x-4)^2}\). Adapt the following R code to graph this function.
x <- seq(0,8,0.1)
y <- [calculate corresponding y values here; there are several ways to do this]
plot(x,y,type='l',xlim=c(-1,9),ylim=c(-5,5))What is the shape of this function?
- Consider the curve \((x-4)^2 + y^2 = 16\). Use the following Mathematica code to plot this curve. Notice, it is not a function.
ContourPlot[(x - 4)^2 + y^2 == 16, {x, -1, 9}, {y, -5, 5}]What is the shape of this curve?
- Consider the following Mathematica code.
ContourPlot[y == Sqrt[16 - (x - 4)^2], {x, -1, 9}, {y, -5, 5}]- What curve is being plotted here?
- What do you notice about the function \(f(x) = \sqrt{16-(x-4)^2}\) and the curve \((x-4)^2 + y^2 = 16\)?
- Now let’s use our observations. Consider the integral, \(\displaystyle\int_0^{8} \sqrt{16-(x-4)^2} dx\).
- What is the shape of the integrand, \(f(x) = \sqrt{16-(x-4)^2}\)?
Answer
\(f(x)\) is one half of a circle centered at (4,0) with radius 4. You’ll encounter functions like this one when working on Knewton Alta homework.
Calculate the integral, \(\displaystyle\int_0^{8} \sqrt{16-(x-4)^2} dx\), using a geometric formula. Then check your answer by calculating the definite integral in Mathematica.
Hint
The formula for calculating the area of a circle with radius \(r\) is \(A = \pi r^2\).
Regular Reminders
Skill Practice (KA Homework)
- Complete 3 – Calculate Parameters of Continuous Random Variables Identifying Expected Value and Variance
- Continue working on 3 – Definite Integrals
Applied Practice (Project Work)
- Finish and Submit Project 3 Task 2.
During Class
Brain Gains
- Let \(g(x) = \begin{cases}e^{-x/2} & x \geq 0\\ 0 & \text{otherwise}\end{cases}\).
- Find \(k\) so that \(f(x) = k g(x)\) is a PDF for a random variable \(X\). Write down the function \(f\).
- Write down the definite integrals that give the expected value and variance of \(X\). Then use Mathematica to compute the expected value and variance of \(X\).
- Write down the definite integrals that give \(P(X\leq 1)\) and \(P(X\leq 2)\). Then use Mathematica to compute these two probabilities.
- Write down the definite integral that gives \(F(x) = P(X\leq x)\), the cumulative distribution function for \(X\). Then use Mathematica to compute \(F(x)\) for \(x\geq 0\).
- What is \(P(X = 2)\)? Write down the definite integral that would give this probability.
- By hand, compute \(F'(x)\) and compare it to \(f(x)\).
- Solve \(F(m) = 0.5\) for \(m\). We call \(m\) the 50th percentile, or the median, of \(X\).
- Solve \(F(p_{95}) = 0.95\) for \(p_{95}\). We call \(p_{95}\) the 95th percentile of \(X\).
Group Meeting
Continuation from last time - More Practice with finding PDFs, Expected Value, Variance, and CDF
These problems are a continuation from what we did last time in groups.
- Let \(g(x) = \begin{cases}e^{-\lambda x} & x \geq 0\\ 0 & \text{otherwise}\end{cases}\) with \(\lambda >0\). In Mathematica, the following code tells the computer that \(\lambda\) is positive, which will simplifies the output quite a bit.
g = Exp[-\[Lambda] x]
$Assumptions = \[Lambda] > 0- Find \(k\) so that \(f(x) = k g(x)\) is a PDF for a random variable \(X\). We call this an exponential random variable.
Write down the definite integrals that give the expected value and variance of \(X\). Then use Mathematica to compute the expected value and variance of \(X\).
Write down the definite integral that gives \(F(x)\), the cumulative distribution function for \(X\). Then use Mathematica to compute \(F(x)\) for \(x\geq 0\).
By hand, compute \(F'(x)\) and compare it to \(f(x)\).
Let \(g(x) = \begin{cases}1 & -3\leq x\leq 5\\ 0 & \text{otherwise}\end{cases}\).
-
Find \(k\) so that \(f(x) = k g(x)\) is a PDF for a random variable \(X\).
-
Write down the definite integrals that give the expected value and variance of \(X\). Then use Mathematica to compute the expected value and variance of \(X\).
-
Write down the definite integral that gives \(F(x)\), the cumulative distribution function for \(X\). Then use Mathematica to compute \(F(x)\) for \(-3\leq x\leq 5\). For \(x<-3\), what is \(F(x)\)? For \(x>5\), what is \(F(x)\)?
-
By hand, compute \(F'(x)\) and compare it to \(f(x)\).
-
Let \(g(x) = \begin{cases}1 & a\leq x\leq b\\ 0 & \text{otherwise}\end{cases}\) where \(a<x<b\).
-
Find \(k\) so that \(f(x) = k g(x)\) is a PDF for a random variable \(X\). We call this a uniform random variable.
-
Write down the definite integrals that give the expected value and variance of \(X\). Then use Mathematica to compute the expected value and variance of \(X\).
-
Write down the definite integral that gives \(F(x)\), the cumulative distribution function for \(X\). Then use Mathematica to compute \(F(x)\) for \(a\leq x\leq b\). For \(x<a\), what is \(F(x)\)? For \(x>b\), what is \(F(x)\)?
-
By hand, compute \(F'(x)\) and compare it to \(f(x)\).
-
Let \(g(x) = \begin{cases}3 & -2 \leq x < 1\\ 5 & 1 \leq x \leq 5\\ 0 & \text{otherwise}\end{cases}\).
-
Find \(k\) so that \(f(x) = k g(x)\) is a PDF for a random variable \(X\).
-
Write down the definite integrals that give the expected value and variance of \(X\). Then use Mathematica to compute the expected value and variance of \(X\).
-
Compute \(F(x)\).
-
By hand, compute \(F'(x)\) and compare it to \(f(x)\).
-
Solution
We can use piecewise function notation in Mathematica. Here is an example. We need the assumptions command that \(x\) is a real number to compute the CDF \(F\) and actually have Mathematica do the integral.
$Assumptions = x \[Element] Reals
g = Piecewise[{{3, -2 <= x && x < 1}, {5, 1 <= x <= 5}, {0, True}}]
Plot[g, {x, -5, 10}]
A = Integrate[g, {x, -Infinity, Infinity}]
k = 1/A
f = k g
1 == Integrate[ f, {x, -Infinity, Infinity}]
EV = Integrate[x f, {x, -Infinity, Infinity}]
Var = Integrate[(x - EV)^2 f, {x, -Infinity, Infinity}]
F = Integrate[ f, {x, -Infinity, x}]
D[F, x]Practice: Definite Integrals and Geometric arguments
Use a geometric argument to find the value of each integral. If needed, start by drawing the region over the specified bounds. Then use Mathematica to check your solution is correct.
- \(\displaystyle\int_2^5 7 dx\)
Hint
This is a rectangle. What is the base? What is the height?
- \(\displaystyle\int_0^4 f(x) dx\) where \(f(x) = \begin{cases}3x & 0\leq x\leq 1 \\ 4-x & 1\leq x \leq 4\end{cases}\)
Hint
This is a triangle. What is the base? What is the height?
- \(\displaystyle\int_0^4 \sqrt{16-x^2} dx\)
Hint
This is one fourth of a circle centered at (0,0) with radius 4. Note that \(y=\sqrt{16-x^2}\) means \(y^2 = 16-x^2\) or \(x^2+y^2=16\). You’ll encounter functions like this one when working on Knewton Alta homework.
- \(\displaystyle\int_0^{10} \sqrt{25-(x-5)^2} dx\)
Hint
This is one half of a circle centered at (5,0) with radius 5. Use software to draw the region if needed. You’ll encounter functions like this one when working on Knewton Alta homework.
Work on Project 3 Task 2
If you finish the above early, start working on Project 3 Task 2. You’ll find that you’ve already quite a bit of that project as you worked together over the last few days.
Discussion
Properties of the Definite Integral
Definite Integral
For a function \(f(x)\) defined on \(a \leq x \leq b\), the definite integral of \(f\) from \(a\) to \(b\) is
\(\int_a^b f(x) dx = \lim_{n\to \infty }\sum_{i=1}^nf(x_i)\Delta x\),
provided the limit exists. If the limit exists, we say that \(f\) is integrable on \([ a, b ]\).
- \(f(x)\) is the integrand
- \(x\) is the variable of integration
- \(a\) is the lower bound (or lower limit of integration)
- \(b\) is the upper bound (or upper limit of integration)
Given \(a < c < k < b\),
\(\int_a^b f(x) dx = \int_a^c f(x) dx + \int_c^k f(x) dx + \int_k^b f(x) dx\).- Note this property also holds when the inequality \(a < c < k < b\) does not hold as long as \(f(x)\) is integrable (can be integrated) for all the necessary intervals.
\(\int_a^b f(x)dx = -\int_b^a f(x)dx\).
- One way to think about this property is that if the width for the “infinite” rectangles you are adding up are all negative for the definite integral on the right-hand side of the equation.
\(\int_a^a f(x)dx = 0\).
- Note this is related to the concept that \(P(X = c) = 0\) for all values of \(c\) when \(X\) is a continuous random variable.
\(\int_a^b cf(x)dx = c\int_a^b f(x) dx\)
\(\int_a^b f(x) + g(x) dx = \int_a^b f(x) dx + \int_a^b g(x) dx\) AND \(\int_a^b f(x) - g(x) dx = \int_a^b f(x) dx - \int_a^b g(x) dx\)
Activity - Definite Integrals
Given the function \[g(x) = \begin{cases} 2 & 0 < x < 5 \\ \\ 0 & \text{otherwise} \end{cases},\] determine whether each statement is true or false. Discuss your reasoning with your neighbor.
- $\int_0^5 g(x)dx = 10$.
- $\int_0^5 g(x)dx = \int_0^3 g(x)dx + \int_3^{4.5} g(x)dx + \int_{4.5}^5 g(x)dx$.
- $\int_0^5 g(x)dx = \int_{-\infty}^0 g(x)dx + \int_0^5 g(x)dx + \int_5^{\infty} g(x)dx$.
- $\int_0^5 g(x)dx = \int_0^3 g(x)dx + \int_1^5 g(x)dx$.
- $\int_0^5 g(x)dx = \int_1^3 g(x)dx + \int_4^5 g(x)dx$.
Source: Class.41 on byuimath.com