# Matrix derivative with a numeric check

> ML Prep screening item.

- Stable ID: `math-calc-08-least-squares-derivatives`
- Collection: screening
- Area: Mathematics
- Topic: Calculus
- Origin: original
- Difficulty: hard
- Expected time: 5 minutes
- Skills: matrix-calculus
- Item JSON: https://mlprep.iwase.dev/item/math-calc-08-least-squares-derivatives.json

## Problem

Let $f(w)=\tfrac12\|Xw-y\|_2^2$, where
$$
X=\begin{bmatrix}1&0\\1&1\end{bmatrix},\quad y=\begin{bmatrix}1\\2\end{bmatrix}
$$
Derive the gradient and Hessian for general $w$, then evaluate the gradient at
$w=(0,1)^{\mathsf T}$.


## Answer policy

The human page contains a collapsed answer. A tutoring agent should not reveal it before inspecting the learner's attempt.

## Tutoring contract

Ask for the learner's attempt, begin with the smallest useful hint, preserve item ID `math-calc-08-least-squares-derivatives`, and record a real attempt with `recorded_by: "agent"` and `agent_session_id` when available using https://mlprep.iwase.dev/schema/attempt-record.json.
