✓ Official Syllabus VerifiedStandards & Rigor ↗
§

Practice set — Part 6 (Q41–Q48)

Fifty applied mathematics problems for AI & Data Science spanning high-dimensional vectors and cosine similarity, neural layer matrix transformations, multivariable calculus and gradient descent optimization, conditional probability and Bayes' theorem, probability distributions and maximum likelihood estimation (MLE), ordinary least squares linear regression, logistic regression and cross-entropy loss, and covariance matrices and Principal Component Analysis (PCA).

41
A vector v is represented in a 2D space. If the components of the vector are v_x = -3 and \(v_y = 4\), what is the Euclidean (\(L_2\)) norm of this vector?
Basic

The Euclidean (\(L_2\)) norm of a vector \(\mathbf{v} = [v_x, v_y]^T\) is calculated as \(\|\mathbf{v}\|_2 = \sqrt{v_x^2 + v_y^2}\). For the given vector \(\mathbf{v}\) with components \(v_x = -3\) and \(v_y = 4\), the norm is: \(\|\mathbf{v}\|_2 = \sqrt{(-3)^2 + (4)^2} = \sqrt{9 + 16} = \sqrt{25} = 5\).

42
A machine learning diagnostic test has sensitivity \(P(\text{Positive} | \text{Defect}) = 0.90\). If the defect rate in production is \(P(\text{Defect}) = 0.25\), find the joint probability of a defect and a positive test result \(P(\text{Defect} \cap \text{Positive})\).
Intermediate

By the multiplication rule of conditional probability: \(P(\text{Defect} \cap \text{Positive}) = P(\text{Defect}) \times P(\text{Positive} | \text{Defect}) = 0.25 \times 0.90 = 0.2250\).

43
A 2D loss surface is defined as \(L(w_1, w_2) = 2w_1^2 + 3w_2^2\). Find the gradient vector \(\nabla L\) at the point \((w_1, w_2) = (2, -1)\).
Advanced

Compute partial derivatives: \(\frac{\partial L}{\partial w_1} = 2(2)w_1 = 4(2) = 8\); \(\frac{\partial L}{\partial w_2} = 2(3)w_2 = 6(-1) = -6\). Therefore, \(\nabla L = [8, -6]^T\).

44
A medical diagnostic test for a rare disease is designed to be highly sensitive and specific. The disease affects \(1\) in every \(1000\) individuals in the population. The test has a sensitivity of \(99\)\% (meaning it correctly identifies \(99\)\% of individuals who have the disease) and a specificity of \(95\)\% (meaning it correctly identifies \(95\)\% of individuals who do not have the disease). If a randomly selected individual from the population tests positive, what is the probability that they actually have the disease?
Advanced

Let D be the event that an individual has the disease, and P be the event that the individual tests positive.
We are given the following probabilities:
- Prior probability of having the disease: \(P(D) = \frac{1}{1000} = 0.001\)
- Prior probability of not having the disease: \(P(D^c) = 1 - P(D) = 1 - 0.001 = 0.999\)
- Sensitivity (true positive rate): \(P(P|D) = 0.99\)
- Specificity (true negative rate): \(P(P^c|D^c) = 0.95\)
From specificity, we can derive the false positive rate: \(P(P|D^c) = 1 - P(P^c|D^c) = 1 - 0.95 = 0.05\).

We want to find the probability that an individual actually has the disease given a positive test result, which is \(P(D|P)\). We can use Bayes' Theorem:

\[P(D|P) = \frac{P(P|D) P(D)}{P(P)}\]

To find \(P(P)\), the overall probability of testing positive, we can use the law of total probability:

\[P(P) = P(P|D) P(D) + P(P|D^c) P(D^c)\]

Substitute the given values:

\[P(P) = (0.99)(0.001) + (0.05)(0.999)\]
\[P(P) = 0.00099 + 0.04995\]
\[P(P) = 0.05094\]

Now, substitute \(P(P)\) back into Bayes' Theorem:

\[P(D|P) = \frac{(0.99)(0.001)}{0.05094}\]
\[P(D|P) = \frac{0.00099}{0.05094}\]
\[P(D|P) \approx 0.0194346\]

Therefore, the probability that a person who tests positive actually has the disease is approximately \(0.0194\), which is closest to \(0.019\).

45
Compute the Manhattan (\(L_1\)) norm and Euclidean (\(L_2\)) norm of the word vector \(\mathbf{w} = [10, -15]^T\).
Intermediate

Step 1 · Manhattan (\(L_1\)) Norm: Summing absolute coordinate magnitudes of \(\mathbf{w} = [10, -15]^T\) gives \(\|\mathbf{w}\|_1 = |10| + |-15| = 10 + 15 = 25\).

Step 2 · Euclidean (\(L_2\)) Norm: Taking the square root of the sum of squared components yields \(\|\mathbf{w}\|_2 = \sqrt{10^2 + (-15)^2} = \sqrt{100 + 225} = \sqrt{325} = 5\sqrt{13} \approx 18.03\) (confirming the universal norm inequality \(\|\mathbf{w}\|_2 \le \|\mathbf{w}\|_1\)).

46
In a multiple linear regression model, the Sum of Squared Errors is \(\text{SSE} = 20\) and the Total Sum of Squares is \(\text{SST} = 100\). What is the coefficient of determination \(R^2\)?
Intermediate

Variance Decomposition & \(R^2\): In ordinary least-squares regression with an intercept, \(\text{SST} = \text{SSR} + \text{SSE}\), where \(\text{SSE} = \sum (y_i - \hat{y}_i)^2 = 20\) and \(\text{SST} = \sum (y_i - \bar{y})^2 = 100\).

The coefficient of determination measures the proportion of total target variance captured by the linear predictors: \[ R^2 = 1 - \frac{\text{SSE}}{\text{SST}} = 1 - \frac{20}{100} = 1 - 0.20 = 0.80 \; (80\%). \]

47
In evaluating a binary classifier, the confusion matrix shows \(TP = 70\), \(TN = 40\), \(FP = 10\), and \(FN = 10\). Compute the overall classification accuracy.
Basic

Confusion Matrix Evaluation: Total evaluated instances equal \(N = TP + TN + FP + FN = 70 + 40 + 10 + 10 = 130\), of which \(TP + TN = 70 + 40 = 110\) are classified into their true ground-truth label.

Therefore, overall classification accuracy is \[ \text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} = \frac{110}{130} = \frac{11}{13} \approx 0.8462 \; (84.6\%). \]

48
A fully-connected dense layer maps an input \(\mathbf{x} \in \mathbb{R}^{50}\) to \(\mathbf{y} \in \mathbb{R}^{25}\) using \(\mathbf{y} = \mathbf{W}\mathbf{x} + \mathbf{b}\). How many total learnable parameters are in this layer?
Basic

Affine Dense Layer Parameter Count: For \(\mathbf{y} = \mathbf{W}\mathbf{x} + \mathbf{b}\) mapping \(\mathbf{x} \in \mathbb{R}^{50}\) to \(\mathbf{y} \in \mathbb{R}^{25}\), each of the \(25\) output neurons connects to all \(50\) inputs, giving \(\mathbf{W} \in \mathbb{R}^{25 \times 50}\) with \(25 \times 50 = 1250\) scalar weights.

Adding one independent bias parameter per output unit (\(\mathbf{b} \in \mathbb{R}^{25}\)) yields \(1250 + 25 = 1275\) total learnable parameters.

AI-assisted, human-reviewed: Questions and walkthroughs are developed with AI assistance and reviewed by senior educators.Report an error here ↗