#2.6
##a) P(sum of 1)=0
##There is no combination that will result in a sum of 0.
##b)P(sum of 5)=4/36
##There are 4 ways to come up with this outcome: 1+4, 2+3, 4+1, 3+2
##Probability of each outcome is 1/6*1/6=1/36
##Total=4/36
##c) P(sum of 12)=1/36
##Only way to get this is 2 sixes.
##Probability is 1/6*1/6=1/36

#2.8
##a) There can be people living below poverty line who speak a foreign language. The two variables are therefore not disjoint.
##b)

library(VennDiagram)
## Warning: package 'VennDiagram' was built under R version 3.5.2
## Loading required package: grid
## Loading required package: futile.logger
## Warning: package 'futile.logger' was built under R version 3.5.2
draw.pairwise.venn(.146, .207, cross.area=.042, cat.pos=c(0,0),fill=c("Blue","Red"), category = c("Speak a language other than English", "Live below the poverty line"))

## (polygon[GRID.polygon.1], polygon[GRID.polygon.2], polygon[GRID.polygon.3], polygon[GRID.polygon.4], text[GRID.text.5], text[GRID.text.6], text[GRID.text.7], text[GRID.text.8], text[GRID.text.9])
##c)P(below poverty and only English)=14.6-4.2=104%
##d)P(below poverty or language other than English)=14.6+20.7-4.2=31.1%
##e)P(above poverty and English)=1-.311=68.9%
##f)If independent, P(A and B)=P(A)*P(B)
##31.1 is not equal to 14.6*20.7
##Therefore the events are not independent

#2.20
##a)P(mblue or fblue)=P(mblue)+P(fblue)-P(mblue and fblue)=(114+108--78)/204=70.5%
##b)P(fblue|mblue)=P(mblue and fblue)/P(mblue)=(78/204)/(114/204)=68.4%
##c)P(fblue|mbrown)=(19/204)/(54/204)=35.2%
##  P(fblue|mgreen)=(11/204)/(36/204)=30.6%
##d)The events are not independent as the probability of blue is significantly higher than other colors.

#2.30
##a)P(hardcover then paperback)=28/95*59/95=18.5%
##b)P(fiction then hardcover with no replacement)=72/95*28/94=22.6%
##c)P(fiction then hardcover with replacement)=72/95*28/95=22.3%
##d)There are 95 books in the sample and we have selected only 2 books, so the impact of returning or not returning 1 book is not much.

#2.38
##a)
fee<-c(0,25,25+35)
passengers<-c(.54, .34, .12)
AvgRev<-sum(fee*passengers)
AvgRev
## [1] 15.7
var<-sum((fee^2)*passengers)-AvgRev^2
var
## [1] 398.01
stdev<-var^(1/2)
stdev
## [1] 19.95019
##Average Revenue is 15.7, Standard deviation is 19.95

##b)
AvgRev120<-AvgRev*120
AvgRev120
## [1] 1884
stdev120<-stdev*(120^(1/2))
stdev120
## [1] 218.5434
##Airline will expect 1884 average revenue with 218.54 standard deviation.

#2.44
##a) The median income is between 35,000 to 49,999.
##The minimum frequency is at 1 to 9999 category
##The distribution looks bimodal 

##b) It is the sum of all probabilities below that category
##Probability=2.2+4.7+15.8+18.3+21.2=62.2%

##c)P(less than 50000 and female)=P(less than 50000)*P(female) assuming independence
##probability=.41*.622=25.5%

##d)There is significant difference between 71.8% and 25.5%
##Therefore the assumption of independence is not correct.