Show \(x^2+exp(x)+2x^4+1\) is convex.
\(f(αx+βy)≤αf(x)+βf(y)\)
\((αx+βy)^2+exp(αx+βy)+2(αx+βy^)4+1≤α(x2+exp(x)+2x4+1)+β(y2+exp(y)+2y4+1\))
Using \(α+β=1\) this can be simplified
\(2αx^4+αx^2+αexp(x)+2βy^4+βy^2+βexp(y)+1−((αx+βy^)2+exp(αx+βy)+2(αx+βy)^4+1)≥0\)
\(2αx4+αx2+αexp(x)+2βy4+βy2+βexp(y)−(αx+βy)2−exp(αx−βy)−2(αx+βy)4≥0\)
The inequality true which shows that \(x^2+exp(x)+2x^4+1\) is convex.
Show that the mean of the exponential distribution \(p(x)=\begin{cases} λe^{−λx}x≥0(λ>0)\\x<0&0\end{cases}\) is $ μ=1λ$ and its variance is \(σ2=1λ\)
To find the mean of the exponential distribution solve \(μ=E[X]=\int\limits_{0}^{\infty}xλe^{−λ}\)
Solve using integration by parts \(∫uvdx=u∫vdx−∫u′(∫vdx)dx\)
\([−xe^{−λx}]^{∞}_{0}+∫^∞_0e^{−λx}dx=\)
\([−xe^{−λx}]^∞_0+[−\frac{1}{λ}e^{−λx}]^∞_0=\)
\((0−0)+(0+\frac{1}{λ}) = \frac{1}{λ}\)
To find the variance of the exponential distribution solve \(σ2=Var[X]=E[X^2]−E[X]^2\)
\(E[X2]=∫^∞_0x2λe^{−λx}\)
which can be solved by again using integration by parts
\([−x^2e^{−λx}]^∞_0+∫^∞_02xe^{−λx}dx\)
\([−x^2e^{−λx}]^∞_0+[\frac{-2}{λ}xe^{-λx}dx]^∞_0+2λ∫^∞_0e^{−λx}dx\)
\([−x2e^{−λx}]^∞_0+[\frac{−2}{λ}xe^{−λx}dx]^∞_0+\frac{2}{λ}[\frac{−1}{λ}xe^{−λx}dx]^∞_0\)
\((\frac{2}{λ})(\frac{1}{λ})=\frac{2}{λ^2}\)
\(E[X^2]−E[X]^2=\frac{2}{λ^2}−(\frac{1}{λ})^2=\frac{2}{λ^2}−\frac{1}{λ^2}=\frac{1}{λ^2}\)
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 λ=4 and show their histogram.
temp <- dpois(4, lambda = 4)
round(temp , 4)
## [1] 0.1954
temp2 <- dpois(0, lambda = 4)
round(temp2, 4)
## [1] 0.0183
result <- rpois(1000, lambda = 4)
hist(result)