Differentiation of Simple Functions
In this session, we introduce differentiation and its fundamental role in mathematical analysis and software development. We begin with the derivative and its geometric meaning as the slope of the tangent line, which is essential for optimisation problems and algorithm analysis.
The session covers differentiation rules including the chain, product, and quotient rules, as well as derivatives of exponential and logarithmic functions. The exercises move from limits and basic derivatives to more advanced rules and applications such as velocity and acceleration. Special emphasis is placed on how differentiation supports machine learning, optimisation, and numerical methods.
Key Concepts¶
- Limits and the derivative as rate of change
- Differentiation rules: power, product, quotient, and chain rules
- Derivatives of exponential and logarithmic functions
- Applications to motion and optimisation
Learning Objectives
- Evaluate limits and interpret the derivative geometrically.
- Differentiate functions using standard rules.
- Apply the product, quotient, and chain rules correctly.
- Find derivatives of exponential and logarithmic functions.
- Use differentiation to analyse velocity, acceleration, and rates of change.
Session Preparation¶
Chapter 10 (English)
Kapitel 10 (Dansk)
Some of the exercises may require you to use Python. You may also need to install the numpy and sympy libraries if you haven't already.
Resources¶
Exercises¶
[Python] Means that you are advised to use Python to solve the exercise. You can find the Python solutions here or download them here
Exercise 1 (Recap)¶
[Python] Given
\(A=\left[\begin{array}{ccc}1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9\end{array}\right]\) and \(B=\left[\begin{array}{ccc}9 & 8 & 7 \\ 6 & 5 & 4 \\ 3 & 2 & 1\end{array}\right]\).
Solve the matrix equation \(X-A=6(X+B)\).
\(X=\left[\begin{array}{ccc}-11 & -10 & -9 \\ -8 & -7 & -6 \\ -5 & -4 & -3\end{array}\right]\)
Exercise 2¶
Find the limits of the following functions:
- \(\lim\limits_{x \to 0} \frac{x^4-4 x^3+x^2}{x^3+x^2+x}\)
- \(\lim\limits_{x \to \infty} \frac{x^2+1}{x^2-1}\)
- \(\lim\limits_{x \to 2} \frac{x-2}{x^2-3 x+2}\)
- \(\lim\limits_{x \to 0} \frac{x^4-4 x^3+x^2}{x^3+x^2+x} = 0\)
- \(\lim\limits_{x \to \infty} \frac{x^2+1}{x^2-1} = 1\)
- \(\lim\limits_{x \to 2} \frac{x-2}{x^2-3 x+2} = 1\)
Exercise 3: Simple Derivatives¶
Find the derivatives of the following functions:
- \(f(x)=x^4\)
- \(f(t)=t^{-\frac{1}{3}}\)
- \(y=t^{-3.8}\)
- \(f'(x)=4x^3\)
- \(f'(t)=-\frac{1}{3}t^{-\frac{4}{3}}\)
- \(y'=-3.8t^{-4.8}\)
Exercise 4: Derivatives of Powers¶
Express the following as powers and then differentiate:
- \(\frac{1}{x^2}\)
- \(\sqrt[3]{x}\)
- \(\frac{1}{x \sqrt[4]{x}}\)
- \(\frac{1}{x^2} = x^{-2}\), derivative: \(\frac{d}{dx}x^{-2} = -2x^{-3}\)
- \(\sqrt[3]{x} = x^{1/3}\), derivative: \(\frac{d}{dx}x^{1/3} = \frac{1}{3}x^{-2/3}\)
- \(\frac{1}{x \sqrt[4]{x}} = x^{-5/4}\), derivative: \(\frac{d}{dx}x^{-5/4} = -\frac{5}{4}x^{-9/4}\)
Exercise 5: Derivatives of Sums and Differences¶
Find the derivatives of the following functions:
- \(y=2 x^{-7}+\frac{3}{x^2}\)
- \(f(u)=u^{\frac{5}{3}}-3 u^{-7}\)
- \(g(z)=8 z^{-2}-\frac{5}{z}\)
- \(\frac{d}{dx}(2 x^{-7}+\frac{3}{x^2}) = -14x^{-8} - 6x^{-3}\)
- \(\frac{d}{dx}(u^{\frac{5}{3}}-3 u^{-7}) = \frac{5}{3}u^{2/3} + 21u^{-8}\)
- \(\frac{d}{dx}(8 z^{-2}-\frac{5}{z}) = -16z^{-3} + \frac{5}{z^2}\)
Exercises 6: Derivatives of Products and Quotients¶
Use the product rule to differentiate the functions below:
- \(f(x)=\left(4 x^3+2\right)(1-3 x)\)
- \(g(x)=\left(x^2+x+2\right)\left(x^2+1\right)\)
- \(h(x)=\frac{x^2-1}{x^3+4}\)
- \(g(t)=\frac{t(t+6)}{t^2+3 t+1}\)
- \(-48x^3 + 12x^2 - 6\)
- \( 4x^3 + 3x^2 + 6x + 1\)
- \(h^{\prime}(x)=\frac{-x^4+3 x^2+8 x}{\left(x^3+4\right)^2}\)
- \(\frac{-3 t^2+2 t+6}{\left(t^2+3 t+1\right)^2}\)
Exercise 7: Derivatives using the Chain Rule¶
- \((2 x+3)^2\)
- \(\left(x^2+2 x+1\right)^{12}\)
- \(f(t)=\sqrt{t^2-5 t+7}\)
- \(z=\left(x+\frac{1}{x}\right)^{\frac{3}{7}}\)
- \(\frac{x}{\sqrt{1-x^2}}\)
- \(8 x+12\)
- \(12(2 x+2)\left(x^2+2 x+1\right)^{11}\)
- \(\frac{2 t-5}{2 \sqrt{t^2-5 t+7}}\)
- \(\frac{3}{7}\left(x+\frac{1}{x}\right)^{-4 / 7}\left(1-\frac{1}{x^2}\right)\)
- \(\frac{1}{\left(1-x^2\right)^{3 / 2}}\)
Exercise 8: Derivatives of Exponential and Logarithmic Functions¶
- \(f(x)=\ln \left(2 x^3\right)\)
- \(f(x)=e^{x^2+x^3}\)
- \(f(x)=\ln \left(e^x+x^3\right)\)
- \(\frac{3}{x}\)
- \(e^{x^2+x^3} (2x+3x^2)\)
- \(\frac{e^x+3x^2}{e^x+x^3}\)
Exercise 9: Applications of Derivatives¶
Velocity is the rate of change of position with respect to time.
Acceleration is the rate of change of velocity with respect to time.
-
Given the position function of a car \(s(t) = 5t^2 + 2t + 1\), where \(t\) is in seconds and \(s(t)\) is in meters, find the velocity function.
Velocity function: \(v(t) = 10t + 2\) m/s
-
Knowing that acceleration is the derivative of velocity, find the acceleration function.
Acceleration function: \(a(t) = 10\) m/s²
-
Calculate the velocity and acceleration of the car at \(t = 3\) seconds.
Velocity at \(t = 3\) seconds: \(v(3) = 32\) m/s
Acceleration at \(t = 3\) seconds: \(a(3) = 10\) m/s²
Challenge Exercises¶
Challenge Exercise 1: Combining Differentiation Rules¶
Given the function
\( f(x)=\frac{x^2\sqrt{3x+1}}{(x-2)^3}. \)
-
Determine the domain of the function.
\( D_f=\left[-\frac13,\infty\right)\setminus\{2\}. \)
-
Determine the range of the function. Hint: What values does the function approach as \(x\) approaches the boundaries of its domain?
\( V_f=\mathbb{R}. \)
-
Find \(f'(x)\).
\( f'(x) = \frac{ \left( 2x\sqrt{3x+1} + \frac{3x^2}{2\sqrt{3x+1}} \right)(x-2)^3 - 3x^2\sqrt{3x+1}(x-2)^2 } {(x-2)^6}. \)
An equivalent simplified form is
\( f'(x) = \frac{ \left( 2x\sqrt{3x+1} + \frac{3x^2}{2\sqrt{3x+1}} \right)(x-2) - 3x^2\sqrt{3x+1} } {(x-2)^4}. \)
-
Calculate \(f'(1)\).
\( f'(1)=-\frac{43}{4}. \)
Challenge Exercise 2: The Derivative from First Principles¶
Find the derivative of each function using the definition
\( f'(x) = \lim_{h\to0} \frac{f(x+h)-f(x)}{h}. \)
You are not allowed to use differentiation rules.
-
\( f(x)=\frac{1}{x+1} \)
\( f'(x)=-\frac{1}{(x+1)^2}. \)
-
\( f(x)=\sqrt{x} \)
Hint: Use the difference of two squares identity:
\( (a+b)(a-b)=a^2-b^2. \)
\( f'(x)=\frac{1}{2\sqrt{x}}. \)
Challenge Exercise 3: L'Hôpital's Rule¶
For some limits, direct substitution gives the form \(\frac{0}{0}\) or \(\frac{\infty}{\infty}\). These are called indeterminate forms.
If both the numerator and denominator approach \(0\), or both approach infinity, the limit can often be found by differentiating the numerator and denominator separately.
L'Hôpital's rule states that
provided that the limit on the right-hand side exists and the original fraction has the form \(\frac{0}{0}\) or \(\frac{\infty}{\infty}\).
Use L'Hôpital's rule to evaluate the following limits:
-
\( \lim_{x\to0}\frac{e^{2x}-1}{x} \)
\( \lim_{x\to0}\frac{e^{2x}-1}{x}=2. \)
-
\( \lim_{x\to0}\frac{\sin(3x)}{x} \)
\( \lim_{x\to0}\frac{\sin(3x)}{x}=3. \)
-
\( \lim_{x\to\infty}\frac{\ln(x)}{x} \)
\( \lim_{x\to\infty}\frac{\ln(x)}{x}=0. \)
Challenge Exercise 4: Optimization¶
A manufacturer of energy drinks wants to minimize the material costs of producing their cans.
Assume that a can can be modelled as a closed cylinder with radius \(r\) and height \(h\). The can must have a volume of \(33\) cl, corresponding to \(330\text{ cm}^3\).
The material used for the cylindrical side of the can is twice as expensive per \(\text{cm}^2\) as the material used for the top and bottom.
-
Introduce suitable variables and formulate an expression for the total material cost. You may use relative costs, where the material for the top and bottom costs 1 per \(\text{cm}^2\), while the material for the side costs 2 per \(\text{cm}^2\).
\[ C(r,h)=4\pi rh+2\pi r^2 \] -
Use the volume constraint to rewrite the cost function as a function of the radius only.
\[ C(r)=\frac{1320}{r}+2\pi r^2 \] -
Determine the radius that minimizes the material cost.
\[ r=\sqrt[3]{\frac{330}{\pi}} \approx 4.72\text{ cm} \] -
Determine the corresponding height of the can.
\[ h\approx 4.72\text{ cm} \] -
Compare your result with the case where all materials have the same cost per \(\text{cm}^2\). Explain why the optimal dimensions are different.
If all materials have the same cost, the optimal dimensions satisfy \(h=2r\).
When the side material is twice as expensive, the optimal dimensions satisfy \(h=r\).
Challenge Exercise 5: Differential Equations¶
Part A
-
Find the function \(f(x)\) given that
\( f'(x)=4x^3-6x^2+2x-1 \)
and
\( f(1)=5. \)
\( f(x)=x^4-2x^3+x^2-x+6. \)
Part B
A differential equation is an equation involving an unknown function and its derivatives. Differential equations are used, among other things, to describe population growth, cooling processes, electrical circuits and motion in physics.
Consider the differential equation
\( y'=2xy. \)
-
Determine whether the function \(g(x)=e^{x^2}\) is a solution to the differential equation.
Yes, \(g\) is a solution.
-
Determine whether the function \(h(x)=2e^{x^2}\) is a solution to the differential equation.
Yes, \(h\) is a solution.
-
Determine whether the function \(k(x)=e^{2x}\) is a solution to the differential equation.
No, \(k\) is not a solution.