Ex 1.

Take the second derivative. If the seconnd derivative \(f^{''}(x) is \ge 0\), then f(x) ix convet.

\(f(x) = x^2 + e^x + 2x^4 + 1\)

\(f^{'}(x) = 2x + e^x + 8x^3\)
\(f^{''}(x) = 2 + e^x + 24x^2 \ge 0\)

Then \(x^2 + e^x + 2x^4 + 1\) is convex.

Ex. 2

Find Mean

\(E(x) \ = \int_{0}^{\infty} t\lambda e^{-\lambda t} \; dt\)
= \(\int_{0}^{\infty} t\ e^{-\lambda t} \; d(\lambda t)\)
= \(\int_{0}^{\infty} -t\; d( e^{-\lambda t} )\)
= \(\int_{0}^{\infty}e^{-\lambda t}dt - \ t e^{-\lambda t}|_{0}^{\infty}\)
= \(\int_{0}^{\infty}e^{-\lambda t}dt -0\)
= \(\frac{1}{\lambda}\)

Find Variance \(EX^2 =\int_{0}^{\infty} t^2\lambda e^{-\lambda t} \; dt\)
= \(\frac{1}{\lambda^2}\int_{0}^{\infty}x^2e^{-x}\:dx\)
= \(\frac{1}{\lambda^2}[-2e^{-x}-2xe^{-y}-x^2e^{-x}]_{0}^{\infty}\)
= \(\frac{2}{\lambda^2}\)

\(Var(X) = EX^2 - (EX)^2\)
= \(\frac{2}{\lambda^2} - \frac{1}{\lambda^2}\)
= \(\frac{1}{\lambda^2}\)

Ex. 3

Q1 <- dpois(4, lambda = 4)
Q1
## [1] 0.1953668

The probability of exactly 4 typos is 0.195.

Q2 <- dpois(0, lambda = 4)
Q2
## [1] 0.01831564

The probabbility of no typo at all is 0.0183.

samples <- 1:1000
Q3 <- rpois(1000, lambda = 4)
hist(Q3)

Above is the histogram of 1000 samples with \(\lambda=4\).