Class 34

Between Class Sessions - Prep for Day 34

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) Reading - Rectangles, Targets, Sums - Sections 1.7 through 2.3

For this Unit, the reading as well as many practice exercises appear in the document Rectangles, Targets, Sums

  1. Read sections 1.7-2.3.

  2. In 1.8 and 1.9 complete a few of the exercises.

  3. Complete a few exercises from 2.1 - 2.3, and come ready to share what you did with your group.

  4. Consider the right triangular region that lies above the \(x\)-axis and under the function \(g(x) = 10-2x\) for \(0\leq x \leq 5\). The triangle is 10 units tall, and 5 units wide. Find the center of mass of that triangle.

  5. Find a number \(k\) so that the area of the triangular region under the function \(f(x) = k(10-2x)\) for \(0\leq x\leq 5\) is 1.

Solutions for 4 and 5

Using https://en.wikipedia.org/wiki/List_of_centroids, we get \(\bar x = \frac{5}{3}\). The area under function \(g\) is \(A = \frac{1}{2}(10)(5) = 25\), which means we can divide the function by 25 (so let \(k=\frac{1}{10}\)) to get \(f(x) = \frac{1}{25}(10-2x)\) and then have the area under \(f\) be 1, instead of 25.

Regular Reminders

Skill Practice (KA Homework)

  • Complete 3 – Discrete Random Variables and Expected Value

Applied Practice (Project Work)

  • Begin Project 3 Task 1
    • Read the instruction.
    • Get started with task 1.

During Class

Brain Gains

Inside a box are 10 strips of paper. On each strip of paper is an integer between 1 and 4. One strip of paper has the number 1 on it, while there are three strips of paper with a 2, three with a 3, and three with a 4. Let \(X\) be the random variable obtained by drawing one strip of paper from this box and writing down the number. The probability mass function for this random variable is \[f(x) = \begin{cases} 0.1& x=1\\ 0.3& x=2\\ 0.3& x=3\\ 0.3& x=4\\ \end{cases}\] The code below constructs a graphical representation of this pmf.

#Shades a target diagram for a probability mass function. 
#Inputs: 
#  x - a vector of data points
#  p - a corresponding vector of probabilities or frequencies
#All widths are 1 unit wide. 
draw_pmf <- function(x,p){
  xs <- c(rbind(x-1/2,x-1/2,x+1/2,x+1/2))
  px <- c(rbind(0,p,p,0))
  par(mar=c(2.5,2.5,0.25,0.25))
  plot.new()
  plot(xs,px,type="l")
  polygon(xs,px,col="gray")
}

x <- c(  1,  2,  3,  4)
p <- c(0.1,0.3,0.3,0.3)
draw_pmf(x,p)
  1. Estimate the \(x\)-coordinate of the geometric center of the target. In particular, is it above or below 2.5?

  2. Compute \(E[X]\), the expected value of \(X\).

  3. Interpret the expected value by writing a sentence that explain what this value means.

Group Discussion

Give each group member 1-2 minutes to share what they prepared from the between class work.

Activity - Targets for Continuous Random Variables

Work on the chalkboard as you complete these problems, and pass the chalk as you finish each part. Leave up your work so that you can compare your answers with your neighbors. If you notice an answer differs from a neighboring group’s, then have a discussion with them.

A Rectangular Target

Let’s suppose for a minute that we have a target, as shown using the code below.

#Shades a target diagram (shades area under) for a function f from a to b. 
#Inputs: 
#  f - a function f(x)
#  a - left end of the target
#  b - right end of the target
#  num_points - how many point are sent into f for plotting. 
draw_target <- function(f,a,b,num_points=100){
  x <- c(a,seq(a,b,(b-a)/num_points),b,a)
  y <- c(0,f(seq(a,b,(b-a)/num_points)),0,0)
  par(mar=c(2.5,2.5,0.25,0.25))
  plot(x,y,type = "l")
  polygon(x,y,col="gray")
}

g <- function(x){5+x*0}
draw_target(g,0,6)
  • Each time we throw a dart, it hits a random spot on the target.
  • Assume the target is oriented on the coordinate plane with the lower left corner at the origin and the bottom side of the target along the x-axis. (We will always think of our target as having the bottom side of the target along the x-axis.) Each point on the target has the same probability of being hit as any other.
  • When a dart falls on the point \((x,y)\), we’ll record just the \(x\)-coordinate and let \(X\) represent this random variable.

The top of the target is given by the function \[g(x) = \begin{cases} 5 & \quad 0 \leq x \leq 6 \\ \\ 0 & \quad \text{otherwise}. \end{cases}\]

  1. Find the total area of the target.

  2. Compute the probability that a dart will land with an \(x\) coordinate at most 4, so compute \(P(X\leq 4)\).

  3. Recall that the cumulative distribution function of \(X\) is the function \(F(x)= P(X\leq x)\). Above we computed \(F(4)\).

    • Compute \(F(1)\), so compute \(P(X\leq 1)\)
    • Compute \(F(2)\)
    • Compute \(F(3)\)
    • Compute \(F(3.5)\)
    • Compute \(F(10)\)
    • Compute \(F(-3)\)
  4. Obtain a formula that gives \(F(x)\) for any real number \(x\). You can check work work in the solution box below.

  5. Find a constant \(k\) so that the area under \(f(x) = k g(x)\) is 1, in other words find the normalized target function.

  6. Compute the derivative of \(F(x)\), and then compare it to the normalized target function.

Solutions for 4 - 6

The cumulative distribution function is \[F(x) = \begin{cases} 0 & \quad x < 0 \\ \\ \frac{x}{6} & \quad 0 \leq x \leq 6 \\ \\ 1 & \quad x > 6. \end{cases}\] The constant \(k\) is \(k = \frac{1}{30}\), namely 1 divided by the area of the original target. This gives the normalized target function as \[f(x) = kg(x) = \begin{cases} \frac{1}{6} & \quad 0 \leq x \leq 6 \\ \\ 0 & \quad \text{otherwise} \end{cases}\] The derivative of \(F\) is \[\frac{dF}{dx}(x) = \begin{cases} 0 & \quad x < 0 \\ \\ \frac{1}{6} & \quad 0 < x < 6 \\ \\ 0 & \quad x > 6 \end{cases}\] Notice that \(f(x) = F'(x)\) at the points where \(F(x)\) is differentiable.

A Triangular Target

We now use a triangular target that lies under the function \[g(x) = \begin{cases} 2x & \quad 0 \leq x \leq 6 \\ \\ 0 & \quad \text{otherwise} \end{cases}\] We can graph this target using the code below.

g <- function(x){2*x}
draw_target(g,0,6)

When a dart falls on the point \((x,y)\), we’ll record just the \(x\)-coordinate and let \(X\) represent this random variable.

  1. What is the total area of this target?

  2. Explain why \(x\)-values on the right side of the target are more frequent outcomes than \(x\)-values on the left side of the target?

    • Calculate \(P(X \leq 3)\). Then calculate \(P(X > 3)\).
  3. Find \(k\) so that the area under the normalized target function \(f(x) = kg(x)\) is 1. How does \(k\) compare to the total area of the target?

  4. Remember \(F(x) = P(X \leq x)\).

    • What is \(F(2.5)\)?
    • Calculate \(F(1)\), \(F(4)\), and \(F(5)\)
    • Calculate \(F(10)\) and \(F(-1)\)
  5. For \(0 \leq x \leq 6\), explain why \(F(x) = \frac{x^2}{36}\). Then explain why \[F(x) = \begin{cases} 0 & \quad x < 0 \\ \\ \frac{x^2}{36} & \quad 0 \leq x \leq 6 \\ \\ 1 & \quad x > 6 \end{cases}\]

  6. Calculate the derivative of \(F(x)\) with respect to \(x\).

    • How does \(F'(x)\) compare to the normalized target function \(f(x)\) where \(k\) is \(\frac{1}{\text{area of the target}}\)?
  7. Use this link to look up the formula for the \(x\)-coordinate of the centroid of a right triangle. Explain why the \(x\)-coordinate of the centroid of this right triangular target is \(4\).

  8. State the expected value \(E[X]\). Remember the expected value of \(X\) is the \(x\)-value of the centroid of the right triangular target.

A Parabolic Spandrel target

Head to section 2.3 of Rectangles, Targets, and Sums and complete the exercises together.

Discussion

Key Ideas (Targets & Continuous Random Variables)

The cumulative distribution function (CDF) of a random variable

The cumulative distribution function of a random variable \(X\) is the function \(F(x) = P(X \leq x)\).

The probability density function (PDF) of a continuous random variable

The probability density function, \(f(x)\), of a continuous random variable \(X\) with cumulative distribution function \(F(x)\), is the derivative of \(F(x)\).

  • Every probability density function is non-negative, in other words \(f(x) \geq 0\).
  • The total area under a probability density function always equals 1.
  • Any function that is non-negative with a total area of 1 can be interpreted as the probability density function of some random variable.
  • If a function \(g(x)\) is non-negative and has a finite total area, we can normalize the function (dividing by the area), like we have been doing with our target functions, to make a PDF.

Source: Class.34 on byuimath.com