2024-12-08 23:47:32 -06:00

237 lines
6.6 KiB
Typst
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#show link: set text(blue)
#set text(font: "Calibri")
#show raw: set text(font: "Fira Code")
#set table.cell(breakable: false)
#set table(stroke: (x, y) => (
left: if x > 0 {
.1pt
},
top: if y == 1 {
0.5pt
} else if y > 1 {
0.1pt
},
))
#set page("us-letter", margin: (x: .5in))
#let solve(solution) = {
block(
inset: (left: 5pt, right: 5pt, top: 10pt, bottom: 10pt),
stroke: blue + .3pt,
fill: rgb(0, 149, 255, 15%),
radius: 4pt,
)[#solution]
}
#let solvein(solution) = {
let outset = 3pt
h(outset)
box(
outset: outset,
stroke: blue + .3pt,
fill: rgb(0, 149, 255, 15%),
radius: 4pt,
)[#solution]
h(outset)
}
#let note(content) = {
block(
inset: (left: 5pt, right: 5pt, top: 10pt, bottom: 10pt),
stroke: luma(20%) + .3pt,
fill: luma(95%),
radius: 4pt,
)[#content]
}
#let notein(content) = {
let outset = 3pt
h(outset)
box(
outset: outset,
stroke: luma(20%) + .3pt,
fill: luma(95%),
radius: 4pt,
)[#content]
h(outset)
}
#align(center)[
= CS 3333 Mathematical Foundations
Homework 6 (100 pts)\
#underline[Price Hiller] | #underline[zfp106]
]
#line(length: 100%, stroke: .25pt)
*Questions*\
Please write down the major intermediate steps. Each question is worth 20 points.
1. A bagel shop has onion bagels, poppy seed bagels, egg bagels, salty bagels, pumpernickel bagels, sesame seed bagels, raisin bagels, cinnamon bagels, whole wheat bagels, and plain bagels. How many ways are there to choose:
#note[NOTE: There are 10 types of bagels.]
#enum(
numbering: "a.",
[
Seven bagels?
#note[
$
n = 10, r = 7\
mat(10 - 1 + 7; 7) = mat(16; 7)
$
]
#solve[$mat(16; 7)$ ($11,440$) possible ways to pick seven bagels.]
],
[
Sixteen bagels?
#note[
$
n = 10, r = 16\
mat(10 - 1 + 16; 16) = mat(25; 16)
$
]
#solve[$mat(25; 16)$ ($2,042,975$) possible ways to pick sixteen bagels.]
],
[
Twenty-one bagels with no more than three onion bagels and at least eight plain bagels?
#note[
By default, 8 of our 21 slots are taken up by the eight plain bagels and can thus be ignored. This leaves us with 13 remaining options.
Since we are allowed no more than 3 onion bagels our options for the remaining 13 are:
#align(
center + horizon,
columns(2)[
#table(
columns: 3,
table.header([Onion], [Not Onion], [Options]),
[0], [13], [$mat(9 - 1 + 13; 13) = mat(21; 13)$],
[1], [12], [$mat(9 - 1 + 12; 12) = mat(20; 12)$],
[2], [11], [$mat(9 - 1 + 11; 11) = mat(19; 11)$],
[3], [10], [$mat(9 - 1 + 10; 10) = mat(18; 10)$],
)
\
\
#solve[
Via the sum rule: $mat(21; 13) + mat(20; 12) + mat(19; 11) + mat(18; 10)$
Or $203,490 + 125,970 + 75,782 + 43,758 = 449,000$ ways to pick.
]
],
)
]
],
)
2. How many solutions does $x_1 + x_2 + x_3 = 15$ have, where $x_1$, $x_2$, and $x_3$ are nonnegative integers with $x_1 <= x_3$, $x_2 <= 4$, and $x_3 >= 0$?
#note[
I will fully admit that the way I solved this is definitely _not_ the intended way. I need to review the textbook for this, as I didn't fully understand the logic from the given example pdf.
I just wrote out all the possible solutions painstakingly by hand for this one :(.
$
mat(
0 + 0 + 15;
1 + 0 + 14;
2 + 0 + 13;
3 + 0 + 12;
4 + 0 + 11;
5 + 0 + 10;
6 + 0 + 9;
7 + 0 + 8;
)
mat(
0 + 1 + 14;
1 + 1 + 13;
2 + 1 + 12;
3 + 1 + 11;
4 + 1 + 10;
5 + 1 + 9;
6 + 1 + 8;
7 + 1 + 7;
)
mat(
0 + 2 + 13;
1 + 2 + 12;
2 + 2 + 11;
3 + 2 + 10;
4 + 2 + 9;
5 + 2 + 8;
6 + 2 + 7;
)
mat(
0 + 3 + 12;
1 + 3 + 11;
2 + 3 + 10;
3 + 3 + 9;
4 + 3 + 8;
5 + 3 + 7;
6 + 3 + 6;
)
mat(
0 + 4 + 11;
1 + 4 + 10;
2 + 4 + 9;
3 + 4 + 8;
4 + 4 + 7;
5 + 4 + 6;
)
$
There are #solvein[$36$] possible solutions.
]
3. Consider rolling a single die. We get the number $x$ of the die.
#enum(
numbering: "a.",
[
If I tell you the number is greater than or equal to 4 ($x >= 4$), what is the probability for the number to be even (x is even)?
#note[
Since our roll is $>= 4$, $Ω = {4, 5, 6}$.
$P(x "is even")$ for the given $Ω$ is $2/3$, because two of our three numbers in our given set are even.
#solve[Probability for the number to be even when $x >= 4$ is $2/3$]
]
],
[
Are the probabilities $P(x "is even")$ and $P(x >= 4)$ independent? How do you prove it?
#solve[
The given probabilities are _not_ independent.
This is because $P(x >= 4)$ conditionally refines our sample space to be of ${4, 5, 6}$.
With that in mind, the set of _even_ numbers in ${4, 5, 6}$ is ${4, 6}$, so our probability can be calculated like so:
$(|{4, 6}|)/(|{4, 5, 6}|) = 2/3$.
Straight from the slides, without knowing that $P(x >= 4)$, we have $P(x "is even") = 1/2$, but knowing that $P(x >= 4)$, we have $P(x "is even") = 2/3$.
]
],
)
4. What is the conditional probability that a randomly generated bit string of length five contains at least three consecutive 0s, given that the last bit is a 1? (Assume the probabilities of a 0 and a 1 are the same)
#note[
+ Let $B = "Number of strings ending with a 1" = 2^4 × 1 = 16$
+ Let $P(B) = "Number of strings with 3 consecutive 0s ending with a 1"/B$
+ $"Number of strings with 3 consecutive 0s ending with a 1" = (2 × 1 × 1 × 1 × 1) + (1 × 1 × 1 × 1 × 1) = 3$
+ #solvein[ $P(B) = 3/16$]
]
5. The passengers of a cruise ship are tested for COVID-19. With this test, 96% of passengers who are infected, test positive. 14% of passengers who are not infected, test positive. It is estimated that 9% of all passengers are infected. What is the probability that a passenger who tests positive is infected?
#note[
+ $P(A|B)$ where $A = "infected"$ and $B = "passengers who test positive"$.
+ $P(B) = (0.09 × 0.96) + (0.14 × 0.91) = 0.2138$
+ $P(A|B) = (0.96 × 0.09) / (0.2138) 0.4041$
+ #solvein[The probability that a passenger who tests positive is infected is $ 40.42%$]
]