Worked solutions - Quiz 10

This page contains sketch notes to some of the quiz questions from Quiz 10. It is not comprehensive. We have tried to include most of the questions where it may not be obvious how to get to the correct answer.

Question 1

\[ \begin{align*} \frac{d}{dx} log(x^2) = \frac{d}{dx} 2 log(x) = 2 \frac{d}{dx} log(x) = \frac{2}{x} \end{align*} \]

Alternatively, via the chain rule, \(u=x^2\), so \(f(x) = log(u)\) and \(du/dx = 2x\). Then

\[ \begin{align*} \frac{d}{dx} log(x^2) = \frac{d}{du} log(u) \frac{du}{dx} = \frac{1}{u} \frac{du}{dx} = \frac{1}{x^2} \times 2x = \frac{2}{x} \end{align*} \]

Question 2

Using the product rule,

\[\begin{split} \begin{align*} \frac{d}{dx} x log(x) & = x \frac{d}{dx} log(x) + log(x) \frac{d}{dx} x \\ & = x \times \frac{1}{x} + log(x) = 1 + log(x) \end{align*} \end{split}\]

Question 3

Using the product rule (or you could use the quotient rule),

\[\begin{split} \begin{align*} \frac{d}{dx} \frac{x}{log(x)} & = x \frac{d}{dx} \frac{1}{log(x)} + \frac{1}{log(x)} \frac{d}{dx} x \\ & = x \times \frac{-1}{xlog(x)^2} + \frac{1}{log(x)} \\ & = \frac{1}{log(x)} - \frac{1}{log(x)^2} \end{align*} \end{split}\]

Question 4

To simplify this, just look at \(i=1\) to start with

\[\begin{split} \begin{align*} \frac{d}{d\beta} log(\beta x_1 + 2 x_1 + 1^2) & = \frac{1}{\beta x_1 + 2 x_1 + 1^2} \frac{d}{d \beta} (\beta x_1 + 2 x_1 + 1^2) \\ & = \frac{x_1}{\beta x_1 + 2 x_1 + 1^2} \end{align*} \end{split}\]

So for any \(i=1,2,...,n\), we have

\[ \begin{align*} \frac{d}{d\beta} log(\beta x_i + 2 x_i + i^2) & = \frac{x_i}{\beta x_i + 2 x_i + i^2} \end{align*} \]

and thus

\[ \begin{align*} \frac{d}{d\beta} \sum_{i=1}^n log(\beta x_i + 2 x_i + i^2) & = \frac{x_i}{\beta x_i + 2 x_i + i^2} = \sum_{i=1}^n \frac{d}{d\beta} log(\beta x_i + 2 x_i + i^2) = \sum_{i=1}^n \frac{x_i}{\beta x_i + 2 x_i + i^2} \end{align*} \]

Question 5

\[ \begin{align*} \frac{d}{d\sigma} \sigma log(\sigma^2) = 2 \frac{d}{d\sigma} \sigma log(\sigma) = 2 \sigma \frac{d}{d\sigma} log(\sigma) + 2 log(\sigma) \frac{d}{d\sigma} \sigma = 2 \frac{\sigma}{\sigma} + 2 log(\sigma) = 2 (1 + log(\sigma)) \end{align*} \]

This can also be written as

\[ \begin{align*} \frac{d}{d\sigma} \sigma log(\sigma^2) = 2 + 2 log(\sigma) = 2 + log(\sigma^2) \end{align*} \]

Question 6

\[\begin{split} \begin{align*} \frac{d}{d\theta} \frac{\theta}{1 + e^\theta} & = \theta \frac{d}{d\theta} \frac{1}{1 + e^\theta} + \frac{1}{1 + e^\theta} \frac{d}{d\theta} \theta \\ & = \theta \frac{-e^\theta}{(1 + e^\theta)^2} + \frac{1}{1 + e^\theta} \\ & = \frac{1}{1 + e^\theta} - \frac{\theta e^\theta}{(1 + e^\theta)^2} \end{align*} \end{split}\]

Question 7

\[ \begin{align*} \int \frac{2x + 3}{x^2 + 3x - 5} dx \end{align*} \]

We notice that if you differentiate the denominator you get the numerator. Using the rule

\[ \begin{align*} \int \frac{F'(x)}{F(x)} dx = log(F(x)) + x \end{align*} \]

we have

\[ \begin{align*} \int \frac{2x + 3}{x^2 + 3x - 5} dx = log(x^2 + 3x - 5) + c \end{align*} \]

where \(c\) is a constant.

Question 9

You may not need to integrate by parts during this course, so don’t worry if this is a bit rusty.

\[ \begin{align*} \int x^2 e^{3x} dx \end{align*} \]

Let \(u=x^2\) so \(du/dx=2x\) and \(dv/dx=e^{3x}\) so \(v = \frac{e^{3x}}{3}\). Then using

\[ \begin{align*} \int_a^b u \frac{dv}{dx} dx = [u v]_a^b - \int_a^b v \frac{du}{dx}dx \end{align*} \]

gives

\[\begin{split} \begin{align*} \int x^2 e^{3x} dx dx = x^2 \frac{e^{3x}}{3} - \int \frac{e^{3x}}{3} 2x dx + c \\ & = \frac{x^2 e^{3x}}{3} - \frac{2}{3} \int x e^{3x} dx + c \end{align*} \end{split}\]

We do the same thing to solve the second term here. This time, let \(u=x\), so \(du/dx=1\). As previously, let \(dv/dx=e^{3x}\) so \(v = \frac{e^{3x}}{3}\). Then

\[\begin{split} \begin{align*} \int x e^{3x} dx & = x \frac{e^{3x}}{3} - \int \frac{e^{3x}}{3} dx \\ & = x \frac{e^{3x}}{3} - \frac{1}{3} \int e^{3x} dx \\ & = x \frac{e^{3x}}{3} - \frac{1}{3} \frac{e^{3x}}{3} \end{align*} \end{split}\]

Putting the two bits together, we have

\[\begin{split} \begin{align*} \int x^2 e^{3x} dx dx & = \frac{x^2 e^{3x}}{3} - \frac{2}{3} \left( x \frac{e^{3x}}{3} - \frac{1}{3} \frac{e^{3x}}{3} \right) + c \\ & = \frac{ e^{3x}}{3^3} \left(3^2 x^2 - 6 x + 1 \right) + c \end{align*} \end{split}\]

Question 10

\[ \begin{align*} \int_0^1 x \alpha x^{\alpha - 1} dx & = \int_0^1 x \alpha x^{\alpha} dx = \left[ \frac{ \alpha x^{\alpha + 1}}{\alpha + 1} \right]_0^1 = \frac{\alpha 1^{\alpha + 1}}{\alpha + 1} - 0 = \frac{\alpha}{\alpha + 1} \end{align*} \]

Question 11

\[ \begin{align*} \int_0^\infty t \lambda e^{-\lambda t} dt \end{align*} \]

Let \(u=t\) and \(dv/dt = \lambda e^{-\lambda t}\). Then \(du/dt = 1\) and \(v = - e^{-\lambda t}\). Then

\[\begin{split} \begin{align*} \int_0^\infty t \lambda e^{-\lambda t} dt & = \left[-t e^{-\lambda t}\right]_0^\infty + \int_0^\infty e^{-\lambda t} dt \\ & = 0 + \left[ \frac{e^{-\lambda t}}{-\lambda} \right]_0^\infty \\ & = - \frac{- e^{-\lambda . 0}}{\lambda} = \frac{1}{\lambda} \end{align*} \end{split}\]

Questions 12-14

For MSc Health Data Science students, more detail is provided in Welcome Week session notes.