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

for f(x) = \(x^2 + e^x +2x^4+1\) to be convex then \(f(\alpha x+\beta y)≤\alpha f(x)+\beta f(y),∀x,y∈Ω,\alpha ≥0,\beta ≥0,\alpha +\beta =1\) or if the function’s second derivative is always positive.

\(f'(x)=2x + e^x +8x^3\) then \(f''(x)=2 + e^x +24x^2\) which is always positive since \(e^x\) is always positive and so is \(24x^2\). Therefore the function is convex.

2) Show that the mean of the exponential distribution

\(\begin{equation*} p(x) = \left\{ \begin{array}{ll} \lambda e^{-\lambda x} & \quad x \geq 0 \\ 0 & \quad x < 0 \end{array} \right. \end{equation*}\)

 

is \(\mu = \frac{1}{\lambda}\) and its variance is \(\sigma^2 = \frac{1}{\lambda^2}\)

 

\(\mu = E[X] = \int ^\infty _0 x \lambda e^{-\lambda x}dx\)

\(= \lambda (-x \frac{-1}{\lambda}e^{-\lambda x} - \int -\frac{1}{\lambda}e^{-\lambda x} \vert ^\infty _0)\)

\(= \lambda (x \frac{1}{\lambda}e^{-\lambda x} -\frac{1}{\lambda ^2}e^{-\lambda x}\vert ^\infty _0)\)

\(=\lambda (\lim_{x \to \infty}x \frac{1}{\lambda}e^{-\lambda x} -\frac{1}{\lambda ^2}e^{-\lambda x} - (0) \frac{1}{\lambda}e^{-\lambda (0)} -\frac{1}{\lambda ^2}e^{-\lambda (0)})\)

\(=\frac{1}{\lambda}\)

To find the variance then \(\sigma^2 = E[X^2]-E[X]^2\)

\(E[X^2] =\int^\infty_0x^2\lambda e^{-\lambda x}dx\)

\(\left[-x^2 \frac{1}{\lambda} e^{-\lambda x}\right]_0^{\infty} + v = -\frac{2}{\lambda^2} e^{-\lambda x}\)

3) It is estimated that there is a typo in every 250 data entries in a database, assuming the number of typos can obey the Poisson distribution. For a given 1000 data entries, what is the probability of exactly 4 typos? What is the probability of no typo at all? Use R to draw 1000 samples with \(\lambda = 4\) and show their histogram.

lambda <- 4

four_typos <- dpois(4, lambda)

zero_typos <- dpois(0, lambda)

(four_typos)
## [1] 0.1953668
(zero_typos)
## [1] 0.01831564
samples <- rpois(1000, lambda)
hist(samples, breaks=seq(-0.5, max(samples)+0.5, 1), col="lightblue", xlab="Number of Typos", main="Histogram of 1000 Samples with Lambda = 4")


The probability of 4 typos is 19% and for 0 typos is 1.8%