Section 1

Question 1

Projectile range: On a flat surface, the distance traveled by projectile is

where is the velocity of the projectile at angle , and is the gravitational acceleration. What should the angle and velocity be to get the maximum range? • Identify the constraints • Construct the Lagrangian • Derive the necessary condition for minimum. No need to solve these, though.

constraints:

constraints:

Primal:

Dual feasability:

Complementary Slackness

  • , (either or = 0)
  • (either or )
  • (either or )
  • (either or )

Extra

we expect the solution to be θ = π/4 (to maximize sin(2θ)) and v₀ = 1 (to maximize range)

For θ = π/4:

Both constraints on θ (θ ≥ 0 and θ ≤ π/2) are “non-binding” because:

  • The lower bound constraint (θ ≥ 0) isn’t active since π/4 > 0
  • The upper bound constraint (θ ≤ π/2) isn’t active since π/4 < π/2

This means θ is strictly within the bounds, not at the boundaries. Therefore λ₁ = 0 and λ₂ = 0

For v₀ = 1:

  • The lower bound constraint (v₀ ≥ 0) is “non-binding” because 1 > 0
    • Therefore λ₃ = 0 due to complementary slackness (λ₃v₀ = 0)
  • The upper bound constraint (v₀ ≤ 1) is “binding” because v₀ = 1
    • The constraint is active (1 = 1)
    • According to complementary slackness, if a constraint is active, its multiplier can be non-zero
    • Therefore λ₄ ≥ 0 (it can be positive)

Question 2

(b) Beam design: We want to design a cantilever beam that can support a vertical load of 10 N at its free end. If the cross-section is circular, what should be its diameter and what should the beam’s length to minimize the deflection of the beam? Maximum deflection of the beam (from structural mechanics) is given by

where F is the applied force, L is the length of the beam, E = 1 GPa is the Young’s modulus, and D is the diameter of the beam. The weight of the beam is restricted to be equal to 10 kg.

• Identify the constraints • Construct the Lagrangian • Derive the necessary condition for minimum. No need to solve these, though.

Question 3

(c) Distance traveled: Distance traveled in time t at velocity v is given by . What is the maximum distance one can travel in 1 hour? The velocity v is restricted to be lower than the speed limit of 100 km/hour.

• Identify the constraints • Construct the Lagrangian • Derive the necessary condition for minimum. No need to solve these, though.

Section 2

When an incompressible isotropic material is stretched in one direction by a pressure equal to its shear modulus, its total energy can be written as:

subject to an incompressibility constraint Write the necessary condition(s) to find the minimum of π by using: • method of reduction (eliminating ) • method of Lagrange multiplier

Reduction

Constraint

Lagrange

Section 3

\max_{\theta_1,\theta_2}\theta_1\theta_2 \quad\text{ subject to }\theta_1^2+\theta_2^2\leq1 $$Derive the Karush–Kuhn–Tucker (KKT) conditions for the problem. Assuming that the constraint is active, solve these necessary conditions to find the solution to the above problem. We want to optimise for

\min_{\theta_1,\theta_2}-\theta_1\theta_2 \quad\text{ subject to }\theta_1^2+\theta_2^2\leq1

\mathcal L^L(\theta_1,\theta_2,\lambda) = -\theta_1\theta_2-\lambda(1-\theta_1^2-\theta_2^2)

\partial L^L/\partial\theta_1 = -\theta_2+2\theta_1\lambda=0

\partial L^L/\partial \theta_2 = -\theta_1 + 2\theta_2\lambda=0

\text{Constraint Active: }\lambda > 0, 1-\theta_1^2-\theta_2^2=0

\lambda = \frac{\theta_2}{2\theta_1} \text{ or }\frac{\theta_1}{2\theta_2}

And if $\theta_1 = \theta_2$ then $\lambda = \frac12$ ## Section 4 Consider two mass-spring systems, with the initial distance between the two masses equal to L (Fig. 1). Masses are m1 and m2 and the springs have stiffnesses k1 and k2. The two masses are acted upon by forces f1 and f2. The total energy of the system is given by

\pi(x_1,x_2)=\frac{k_1}2x^2_1-f_1x_1+\frac{k_2}2x

where x1 and x2 are the displacements of two masses. This energy must be minimised to attain equilibrium, however the masses cannot pass each other. That is there is a contact constraint, $L + x2 − x1 ≥ 0$. Formulate the Lagrangian and derive the KKT conditions required for this optimisation problem. ![[Pasted image 20250506180656.png]] **Identify the constraints:** - Contact constraint: L + x₂ - x₁ ≥ 0 (masses cannot pass each other) **Construct the Lagrangian:** We need to minimize the total energy: $π(x₁, x₂) = (k₁/2)x₁² - f₁x₁ + (k₂/2)x₂² - f₂x₂$ Subject to the inequality constraint L + x₂ - x₁ ≥ 0. Using KKT conditions, the Lagrangian is: $$L(x₁, x₂, \lambda) = (k₁/2)x₁² - f₁x₁ + (k₂/2)x₂² - f₂x₂ - \lambda(L + x₂ - x₁)$$ **Derive the KKT conditions:** Stationarity Points: $∂L/∂x₁ = k₁x₁ - f₁ + \lambda = 0$ , $∂L/∂x₂ = k₂x₂ - f₂ - \lambda = 0$ 1. Dual feasibility: $\lambda ≥ 0$ 2. Primal feasibility: $L + x₂ - x₁ ≥ 0$ 3. Complementary slackness: $\lambda(L + x₂ - x₁) = 0$ ## Section 5 Consider the problem of least square and model fitting, when we have two data points $x = [1, 1]$ and $\hat y = [1.2, 1.3]$. If we fit a linear model $Y(x; θ) = θ_1x + θ_0$, calculate the matrix $J^⊤J$ and its rank (number of non-zero eigenvalues). Can we invert this matrix? ***Solution*** When fitting a linear model $Y(x; \theta) = \theta_1x + \theta_0$ to data points using least squares, we want to minimize: $$\sum_{i=1}^n (y_i - (\theta_1x_i + \theta_0))^2$$ Given: - Data points: $x = [1, 1]$ and $\hat{y} = [1.2, 1.3]$ - Model: $Y(x; \theta) = \theta_1x + \theta_0$ Step 1: Calculate the Jacobian matrix $J$. For a linear model $Y(x; \theta) = \theta_1x + \theta_0$, the residuals are: $$r_i(\theta) = y_i - (\theta_1x_i + \theta_0)$$ The Jacobian is the matrix of partial derivatives of the residuals with respect to the parameters: $$J_{ij} = \frac{\partial r_i}{\partial \theta_j}$$ For our model: $$\frac{\partial r_i}{\partial \theta_0} = -1$$ $$\frac{\partial r_i}{\partial \theta_1} = -x_i$$ For our data points $x = [1, 1]$: $$J = \begin{bmatrix} \frac{\partial r_1}{\partial \theta_0} & \frac{\partial r_1}{\partial \theta_1} \\ \frac{\partial r_2}{\partial \theta_0} & \frac{\partial r_2}{\partial \theta_1} \end{bmatrix} = \begin{bmatrix} -1 & -1 \\ -1 & -1 \end{bmatrix}$$ Step 2: Calculate $J^T J$. $$J^T = \begin{bmatrix} -1 & -1 \ -1 & -1 \end{bmatrix}$$ $$J^T J = \begin{bmatrix} -1 & -1 \\ -1 & -1 \end{bmatrix} \begin{bmatrix} -1 & -1 \\ -1 & -1 \end{bmatrix} = \begin{bmatrix} 2 & 2 \\ 2 & 2 \end{bmatrix}$$ Step 3: Determine the rank (number of non-zero eigenvalues) of $J^T J$. To find the eigenvalues, we solve: $$|J^T J - \lambda I| = 0$$ $$\begin{vmatrix} 2-\lambda & 2 \\ 2 & 2-\lambda \end{vmatrix} = 0$$ $$(2-\lambda)^2 - 4 = 0$$ $$4 - 4\lambda + \lambda^2 - 4 = 0$$ $$\lambda^2 - 4\lambda = 0$$ $$\lambda(\lambda - 4) = 0$$ So the eigenvalues are $\lambda_1 = 0$ and $\lambda_2 = 4$. Since there is only one non-zero eigenvalue, the rank of $J^T J$ is 1. Step 4: Determine if we can invert $J^T J$. A matrix is invertible if and only if its determinant is non-zero, or equivalently, if it has full rank (all eigenvalues are non-zero). Since $J^T J$ has rank 1 (which is less than its dimension 2), it is not invertible. We can also verify this by calculating the determinant: $$\det(J^T J) = 2 \times 2 - 2 \times 2 = 4 - 4 = 0$$ Since the determinant is zero, $J^T J$ is singular and cannot be inverted. The reason for this is that our data points have the same x-coordinate (x = [1, 1]), which means we cannot uniquely determine the slope of the line. This creates a linear dependency in our equations, resulting in a singular matrix. ## Section 6 Consider the problem of beam design. Assuming beam’s length is fixed, and we can only vary its cross-section. We consider two scenarios: a uniform beam or a non-uniform beam (Fig. 2). What are the dimensions of the optimisation problems for these two scenarios? ![[Pasted image 20250506180937.png]] ## Section 7 The problem of finding shortest path between two points $(x_1, y_1)$ and $(x_2, y_2)$ can be framed as a functional optimisation problem. Specifically, minimizing the functional

\mathcal L(y) = \int^{x_2}_{x_1}\sqrt{1+(y’)^2}dx

Derive the Euler–Lagrange equation and the associated boundary conditions. ## Section 8 Brachistochrone problem: Given two points A at coordinates (x1, y1) and B at coordinates (x2, y2), find the path joining the two points such that a bead sliding down under gravity travels from A to B in the shortest time. This can be formulated as minimising the functional (ignoring the $√ 2g$ term, since it is a constant):

\mathcal L(y) = \int^{x_2}_{x_1}\sqrt{\frac{1+(y’)^2}y}dx

***Solution:*** For a general functional $\int f\left(y, y^{\prime}, x\right) d x$, the Euler-Lagrange equation is:

\frac{\partial f}{\partial y}-\frac{d}{d x}\left(\frac{\partial f}{\partial y^{\prime}}\right)=0

For the given functional, write $f, \partial f / \partial y$, and $\partial f / \partial y^{\prime}$

f=\sqrt{\frac{1+\left(y^{\prime}\right)^2}{y}} ; \frac{\partial f}{\partial y}=\frac{-1}{2} \sqrt{\frac{1+\left(y^{\prime}\right)^2}{y^3}} ; \frac{\partial f}{\partial y^{\prime}}=\frac{1}{\partial y^{\prime}}

-\frac{1}{2} \sqrt{\frac{1+\left(y^{\prime}\right)^2}{y^3}}=\frac{d}{d x}\left(\frac{y^{\prime}}{\sqrt{y\left(1+\left(y^{\prime}\right)^2\right)}}\right)

y\left(x_1\right)=y_1 \quad & \quad y\left(x_2\right)=y_2