Полигон YMLSYMLS PolygonТашкент · 2026Tashkent · 2026
до попыткиuntil the attempt —
Лекция 2 · 14 октября 2026Lecture 2 · October 14, 2026m02АнализCalculusМатрицыMatricesОптимизацияOptimizationCM.7CM.9CM.10CM.11CM.12CM.13CM.14CM.15CM.16

Цепное правило, экстремумы и множители ЛагранжаChain rule, extrema, and Lagrange multipliers

Производная превращает композицию в произведение матриц, а условие «производная равна нулю» — в уравнения для кандидатов в экстремум, с ограничениями и безThe derivative turns a composition into a product of matrices, and the condition “the derivative is zero” into equations for extremum candidates, with and without constraints

решено 0 из 200 of 20 solved

цель урокаlesson goal
RU

К концу урока ты считаешь производную функции от матрицы по соглашению лектора $U\mapsto\tr(Df(X_0)\,U)$, проводишь цепное правило через вторые производные при замене переменных, находишь минимум функции потерь линейной регрессии через нормальные уравнения и решаешь задачи с ограничениями методом множителей Лагранжа, включая максимум энтропии. Проверка — пять финальных задач ниже, m0219 идёт мини-тестом.

EN

By the end of the lesson, you compute the derivative of a function of a matrix in the lecturer’s convention $U\mapsto\tr(Df(X_0)\,U)$, carry the chain rule through second derivatives under a change of variables, find the minimum of the linear regression loss through the normal equations, and solve constrained problems with Lagrange multipliers, including maximum entropy. Check yourself with the five final problems below; m0219 is the mini-test.

Самостоятельные задачиIndependent problems

К концу урока эти задачи нужно решать без подсказок.By the end of the lesson, solve these problems without hints.

m0216ступень 4step 4Найти матрицу $Df(X_0)$ для нелинейной функции от матрицы $f(X)=a^tX^2b$ и не перепутать её с транспонированнойFind the matrix $Df(X_0)$ for the nonlinear matrix function $f(X)=a^tX^2b$ without confusing it with its transposeк задаче →to the problem →m0217ступень 4step 4Посчитать вторую производную сложной функции при нелинейной замене переменных, не потеряв слагаемое с первой производнойCompute a second derivative of a composite function under a nonlinear change of variables without losing the first-derivative termк задаче →to the problem →m0218ступень 4step 4Обучить линейную регрессию на четырёх точках через нормальные уравнения и выдать прогнозTrain a linear regression on four points through the normal equations and make a predictionк задаче →to the problem →m0219ступень 4step 4Найти условный минимум квадратичной функции на плоскости методом множителей Лагранжа — мини-тест урокаFind a constrained minimum of a quadratic function on a plane with Lagrange multipliers — the lesson’s mini-testк задаче →to the problem →m0220ступень 4step 4Получить распределение максимальной энтропии при заданном среднем и узнать в нём экспоненциальную форму softmaxDerive the maximum-entropy distribution with a given mean and recognize the exponential form of softmax in itк задаче →to the problem →
Мост · что нужно вспомнитьBridge · what to recall
RU

Лекция 1 (урок m01) ввела производную $f:\R^N\to\R^D$ как матрицу $D\times N$, градиент наименьших квадратов и след. Сегодня лектор уточнил, что матрица — только запись: сама производная есть линейное отображение. Отсюда производная по матрице и доказательство цепного правила.

Частные производные, в том числе вторые и смешанные, — это пункт F3.7 очереди «подтягиваем базу» (урок f01). Без них замена переменных из домашнего задания не пойдёт, поэтому проверь эту ступень до задач m0203–m0217.

Экстремумы одной переменной и правило «концы отрезка проверяются отдельно» — из дня 5 Полигона, правило Лопиталя — из дня 6, системы $2\times2$ — из дня 10. В Полигоне транспонирование обозначалось заглавной буквой T, а векторы писались строками; здесь, как у лектора, $x^t$ и столбцы.

EN

Lecture 1 (lesson m01) introduced the derivative of $f:\R^N\to\R^D$ as a $D\times N$ matrix, the least-squares gradient, and the trace. Today the lecturer clarified that the matrix is only a way of writing: the derivative itself is a linear map. This gives the derivative with respect to a matrix and the proof of the chain rule.

Partial derivatives, including second and mixed ones, are item F3.7 of the catch-up queue (lesson f01). Without them the change of variables in the homework will not go through, so check that rung before problems m0203–m0217.

Extrema in one variable and the rule “check the endpoints separately” come from Poligon day 5, L’Hôpital’s rule from day 6, and $2\times2$ systems from day 10. Poligon marked the transpose with a capital letter T and wrote vectors as rows; here, as in the lecture, we write $x^t$ and columns.

Вспомни вслух, до открытия конспектовRecall aloud before opening your notes

  1. Частная производная $\partial f/\partial x^i$: дифференцируешь по $x^i$, остальные координаты считаешь числамиPartial derivative $\partial f/\partial x^i$: differentiate with respect to $x^i$ and treat the other coordinates as numbers
  2. Для $f:\R^N\to\R$ производная $Df(x_0)$ — строка $1\times N$ из частных производных, градиент $\nabla f(x_0)=Df(x_0)^t$ — столбецFor $f:\R^N\to\R$ the derivative $Df(x_0)$ is a $1\times N$ row of partial derivatives; the gradient $\nabla f(x_0)=Df(x_0)^t$ is a column
  3. Цепное правило одной переменной: $\big(f(g(t))\big)' = f'(g(t))\,g'(t)$Chain rule in one variable: $\big(f(g(t))\big)' = f'(g(t))\,g'(t)$
  4. Число равно своему следу, и $\tr(AB)=\tr(BA)$, когда оба произведения определеныA number equals its own trace, and $\tr(AB)=\tr(BA)$ whenever both products are defined
  5. $\tr(CU)=\sum_{i,j}c_{ji}u_{ij}$: след произведения — сумма произведений элементов $C^t$ и $U$, стоящих на одинаковых местах$\tr(CU)=\sum_{i,j}c_{ji}u_{ij}$: the trace of the product is the sum of products of entries of $C^t$ and $U$ in the same positions
  6. $(AB)^t=B^tA^t$ и $(A^t)^t=A$$(AB)^t=B^tA^t$ and $(A^t)^t=A$
  7. Из лекции 1: у $f(x)=\lVert b-Ax\rVert^2$ производная $Df(x)=-2(b-Ax)^tA$From lecture 1: for $f(x)=\lVert b-Ax\rVert^2$ the derivative is $Df(x)=-2(b-Ax)^tA$
  8. Формула Тейлора одной переменной: $g(1)=g(0)+g'(0)+\frac12g''(\tau)$ для некоторого $\tau\in(0,1)$Taylor’s formula in one variable: $g(1)=g(0)+g'(0)+\frac12g''(\tau)$ for some $\tau\in(0,1)$
  9. Система $2\times2$ с ненулевым определителем имеет ровно одно решениеA $2\times2$ system with a nonzero determinant has exactly one solution
  10. Правило Лопиталя: предел $F/G$ вида $\infty/\infty$ равен пределу $F'/G'$, если последний существуетL’Hôpital’s rule: the limit of $F/G$ of the form $\infty/\infty$ equals the limit of $F'/G'$ if the latter exists
  11. Ранг матрицы — наибольшее число линейно независимых строкThe rank of a matrix is the largest number of linearly independent rows
зачем это в MLwhy this matters for ML
RU

Обучение модели — это задача минимизации функции потерь, и сегодняшняя лекция дала весь её каркас. Цепное правило $D(F\circ G)=DF\cdot DG$ — это обратное распространение ошибки: сеть есть композиция слоёв, и её производная есть произведение матриц Якоби слоёв, которые перемножают справа налево. Веса слоя — матрица $W$, поэтому производная по матрице нужна буквально на каждом шаге обучения.

Условие $Df=0$ даёт только кандидатов: минимумы, максимумы и седловые точки. Применённое к $\lVert b-Ax\rVert^2$, оно даёт нормальные уравнения $A^tAx=A^tb$ — точное решение линейной регрессии. Когда на параметры наложены ограничения (вероятности неотрицательны и в сумме дают 1), работают множители Лагранжа. Пример лектора — максимум энтропии — ведёт к равномерному распределению, а с ограничением на среднее — к экспоненциальной форме, которая в классификации называется softmax. Энтропия и перекрёстная энтропия — стандартная функция потерь в классификации.

EN

Training a model is minimizing a loss function, and today’s lecture gave the whole frame for it. The chain rule $D(F\circ G)=DF\cdot DG$ is backpropagation: a network is a composition of layers, and its derivative is the product of the layers’ Jacobian matrices, multiplied from right to left. The weights of a layer form a matrix $W$, so the derivative with respect to a matrix is needed at literally every training step.

The condition $Df=0$ gives only candidates: minima, maxima, and saddle points. Applied to $\lVert b-Ax\rVert^2$, it gives the normal equations $A^tAx=A^tb$ — the exact solution of linear regression. When the parameters are constrained (probabilities are nonnegative and sum to 1), Lagrange multipliers do the work. The lecturer’s example — maximum entropy — leads to the uniform distribution, and with a constraint on the mean, to the exponential form that classification calls softmax. Entropy and cross-entropy are the standard classification loss.

Навыки по порядкуSkills in order

Тема разбита на микронавыки от простого к сложному. У каждого — тренировочные задачи.The topic is split into micro-skills from simple to complex, each with its practice problems.

  1. 1Производная по направлениюDirectional derivativeСужаешь $f$ на прямую $x_0+tu$ или на кривую и считаешь $g'(0)=Df(x_0)\,u$ цепным правиломRestrict $f$ to the line $x_0+tu$ or to a curve and compute $g'(0)=Df(x_0)\,u$ with the chain rulem0201m0205
  2. 2Производная по матрицеDerivative with respect to a matrixРаскладываешь $f(X_0+hU)$ по степеням $h$, превращаешь линейную часть в $\tr(ZU)$ и читаешь $Z=Df(X_0)$ без транспонированияExpand $f(X_0+hU)$ in powers of $h$, turn the linear part into $\tr(ZU)$, and read off $Z=Df(X_0)$ without transposingm0202m0206m0211m0216
  3. 3Тейлор второго порядка через $g(t)$Second-order Taylor via $g(t)$Сужаешь $f$ на отрезок, считаешь $g''(0)=(b-a)^tH(b-a)$ и собираешь приближение второго порядкаRestrict $f$ to a segment, compute $g''(0)=(b-a)^tH(b-a)$, and assemble the second-order approximationm0207m0212
  4. 4Замена переменныхChange of variablesПересчитываешь первые и вторые частные производные при замене координат: решаешь систему $2\times2$ и дифференцируешь частные производные ещё раз по цепному правилуConvert first and second partial derivatives under a change of coordinates: solve a $2\times2$ system and differentiate partial derivatives once more with the chain rulem0203m0208m0213m0217
  5. 5Ферма и наименьшие квадратыFermat and least squaresИщешь кандидатов из $Df=0$ только во внутренних точках, отдельно проверяешь границу и решаешь нормальные уравнения $A^tAx=A^tb$Look for candidates from $Df=0$ only at interior points, check the boundary separately, and solve the normal equations $A^tAx=A^tb$m0209m0210m0214m0218
  6. 6Множители Лагранжа и максимум энтропииLagrange multipliers and maximum entropyЗаписываешь $\nabla f=\sum\lambda_i\nabla g_i$ вместе с ограничениями, проверяешь ранг и решаешь систему из $N+r$ уравненийWrite $\nabla f=\sum\lambda_i\nabla g_i$ together with the constraints, check the rank, and solve the system of $N+r$ equationsm0204m0215m0219m0220

УрокLesson

разбираем с нуляfrom first principles
RU

Вход: минимум на прямой

Функция $f(x)=(x^1)^2+2(x^2)^2$ на плоскости. Где она меньше всего, если точка обязана лежать на прямой $x^1+x^2=3$? Без ограничения ответ — начало координат, но оно на прямую не попадает. Чтобы ответить, нужны три вещи из сегодняшней лекции: производная вдоль прямой (цепное правило), условие «производная равна нулю» (теорема Ферма) и способ учесть ограничение (множители Лагранжа). Ответ — в конце раздела про Лагранжа.

Производная — это линейное отображение

Лекция началась с уточнения. Матрица $A\in M_{D\times N}$ задаёт отображение $u\mapsto Au$, и оно линейно: $A(u+v)=Au+Av$, $A(\lambda u)=\lambda Au$. Любое линейное отображение $\R^N\to\R^D$ записывается такой матрицей. Поэтому в определении из лекции 1

$$f(x_0+u)-f(x_0)=Df(x_0)\,u+o(\lVert u\rVert)$$

производная $Df(x_0)$ по своей природе — линейное отображение, а матрица — способ его записать.

Способ записи — выбор, как выбор системы координат. Линейные функции $\R^N\to\R$ записывают строками: строка $a^t$ действует по правилу $u\mapsto a^tu$. Поэтому при $D=1$ производная — строка. Если же аргумент — матрица, нужна другая запись.

Производная функции от матрицы (соглашение лектора)

Линейная функция $M_{m\times n}\to\R$ записывается матрицей $C\in M_{n\times m}$, которая действует по правилу $U\mapsto\tr(CU)$. Для $f:M_{m\times n}\to\R$ производная $Df(X_0)\in M_{n\times m}$ определяется равенством

$$f(X_0+U)-f(X_0)=\tr\big(Df(X_0)\,U\big)+o(\lVert U\rVert).$$

Практическая форма: если для всех $U$ выполнено $\lim_{h\to0}\frac{f(X_0+hU)-f(X_0)}{h}=\tr(ZU)$, а $f$ дифференцируема, то $Z=Df(X_0)$.

Размеры сходятся: $C$ размера $n\times m$, $U$ размера $m\times n$, произведение $CU$ квадратное $n\times n$, и у него есть след. Лектор сказал прямо: «это моё соглашение». Оно объясняет ответ $b\,a^t$ для $f(X)=a^tXb$ из лекции 1: там $a^tUb=\tr(a^tUb)=\tr(b\,a^tU)$.

Пример. $f(X)=\tr(X^tX)=\lVert X\rVert^2$, $X\in M_{m\times n}$. Подставляем $X_0+hU$ и раскрываем скобки:

$$f(X_0+hU)=\tr(X_0^tX_0)+h\,\tr(U^tX_0)+h\,\tr(X_0^tU)+h^2\tr(U^tU).$$

Матрица и транспонированная имеют один след, поэтому $\tr(U^tX_0)=\tr\big((X_0^tU)^t\big)=\tr(X_0^tU)$. Делим разность на $h$ и устремляем $h\to0$: остаётся $2\tr(X_0^tU)$. Значит, $Df(X_0)=2X_0^t$, размер $n\times m$.

Транспонирование, которое теряют

Библиотеки машинного обучения хранят градиент по матрице весов $W$ в форме самой $W$. Это $(Df)^t$, а не $Df$. Внутри одного решения держись одного соглашения: в этом курсе $Df(X_0)$ стоит слева от $U$ под следом. Проверка размером: для $X\in M_{m\times n}$ матрица $Df(X_0)$ обязана иметь размер $n\times m$.

Зачем это в ML

Слой сети — это $x\mapsto Wx$ с матрицей весов $W$. Шаг обучения сдвигает $W$ на $-\eta\,(Df)^t$, поэтому производную по матрице считают для каждого слоя на каждом шаге.

Доказательство цепного правила

Идея в одной фразе: даём $t$ приращение $\Delta t$, смотрим, насколько сдвинулось $u$ (это $\Delta u$), и насколько изменилось $f$. Лектор разобрал основной случай: $y=f(u^1,\dots,u^N)$, $u^j=g_j(t)$, производная $Df(u_0)$ существует, все $g_j'(t_0)$ существуют, $u_0=g(t_0)$.

Шаг 1. Вспомогательная функция $G$. По определению производной $f(u_0+\Delta u)-f(u_0)=Df(u_0)\Delta u+o(\lVert\Delta u\rVert)$. Положим

$$G(\Delta u)=\begin{cases}\dfrac{f(u_0+\Delta u)-f(u_0)-Df(u_0)\Delta u}{\lVert\Delta u\rVert}, & \Delta u\neq0,\\[4pt] 0, & \Delta u=0.\end{cases}$$

Тогда $\lim_{\Delta u\to0}G(\Delta u)=0$, и равенство

$$f(u_0+\Delta u)-f(u_0)=Df(u_0)\Delta u+G(\Delta u)\,\lVert\Delta u\rVert$$

верно для любого $\Delta u$: при $\Delta u\ne0$ это определение $G$, умноженное на $\lVert\Delta u\rVert$, а при $\Delta u=0$ обе части равны нулю.

Зачем $G$. Дальше мы делим на $\Delta t$, а $\Delta u$ может оказаться нулём при $\Delta t\ne0$ (например, если $g$ постоянна около $t_0$). Делить на $\lVert\Delta u\rVert$ тогда нельзя, а форма с $G$ этот случай покрывает.

Шаг 2. Подстановка. Берём $\Delta u=g(t_0+\Delta t)-g(t_0)$ и делим на $\Delta t$:

$$\frac{f(g(t_0+\Delta t))-f(g(t_0))}{\Delta t}=\sum_{j=1}^{N}\frac{\partial f}{\partial u^j}(u_0)\,\frac{g_j(t_0+\Delta t)-g_j(t_0)}{\Delta t}+G(\Delta u)\frac{\lVert\Delta u\rVert}{\Delta t}.$$

Шаг 3. Лишнее слагаемое стремится к нулю. Его модуль равен $\lvert G(\Delta u)\rvert\cdot\big\lVert\frac{\Delta u}{\Delta t}\big\rVert$. Каждая $g_j$ дифференцируема, значит непрерывна, поэтому $\Delta u\to0$ и $G(\Delta u)\to0$. Второй множитель стремится к длине конечного вектора $(g_1'(t_0),\dots,g_N'(t_0))^t$. Произведение стремится к нулю, и

$$\left.\frac{dy}{dt}\right|_{t_0}=\sum_{j=1}^{N}\frac{\partial f}{\partial u^j}(u_0)\,g_j'(t_0).\qquad\blacksquare$$

При $N=1$ это то же доказательство обычного цепного правила.

Цепное правило в общем виде

Для отображений $G:\R^N\to\R^M$ и $F:\R^M\to\R^D$ (здесь $G$ — другое отображение, не функция из доказательства)

$$D(F\circ G)(x_0)=DF\big(G(x_0)\big)\,DG(x_0).$$

Справа композиция линейных отображений, в матрицах — произведение размеров $(D\times M)(M\times N)$.

Лектор: производная так важна потому, что превращает композицию нелинейных отображений в композицию линейных и сохраняет саму композицию.

Зачем это в ML

Обратное распространение ошибки — это ровно эта формула для сети из многих слоёв: матрицы Якоби слоёв перемножаются, начиная с последнего слоя.

Производная по направлению

Положим $g(t)=f(x_0+tu)$: это $f$, суженная на прямую через $x_0$ с направлением $u$. Внутренняя функция $t\mapsto x_0+tu$ имеет производную $u$, поэтому по цепному правилу

$$g'(0)=Df(x_0)\,u=\langle\nabla f(x_0),u\rangle.$$

Это производная по направлению: скорость изменения $f$, когда точка движется только вдоль этой прямой.

Пример. $f(x)=(x^1)^2x^2$, $x_0=(1,2)^t$, $u=(1,1)^t$. Частные производные $2x^1x^2=4$ и $(x^1)^2=1$, значит $Df(x_0)=(4,\ 1)$ и $g'(0)=4\cdot1+1\cdot1=5$. Проверка подстановкой: $g(t)=(1+t)^2(2+t)$, $g'(t)=2(1+t)(2+t)+(1+t)^2$, $g'(0)=4+1=5$.

Две ошибки, которые лектор исправил у доски

Не пиши $f'$ для функции многих переменных — пиши $Df$. Порядок важен: $u$ стоит справа от $Df(x_0)$, потому что это произведение матриц. И производная берётся при $t=0$: в ответе не должно остаться $t$.

Если двигаться не по прямой, а по кривой $\gamma(t)$, то так же $\frac{d}{dt}f(\gamma(t))=Df(\gamma(t))\,\gamma'(t)$.

Тейлор для функции многих переменных

Возьмём $f:\R^N\to\R$ и точки $a,b\in\R^N$. Сузим $f$ на отрезок между ними:

$$g(t)=f\big((1-t)a+tb\big),\qquad t\in[0,1].$$

Внутренняя функция имеет производную $b-a$. Все частные производные ниже берутся в точке $(1-t)a+tb$:

$$g'(t)=\sum_{i=1}^{N}\frac{\partial f}{\partial x^i}\,(b^i-a^i),$$$$g''(t)=\sum_{i=1}^{N}\sum_{j=1}^{N}\frac{\partial^2 f}{\partial x^j\partial x^i}\,(b^j-a^j)(b^i-a^i),$$$$g'''(t)=\sum_{k=1}^{N}\sum_{j=1}^{N}\sum_{i=1}^{N}\frac{\partial^3 f}{\partial x^k\partial x^j\partial x^i}\,(b^k-a^k)(b^j-a^j)(b^i-a^i).$$

Каждая следующая производная добавляет ещё одну сумму и ещё один множитель вида $(b-a)$: к $g'$ применяется то же цепное правило, только вместо $f$ стоит $\partial f/\partial x^i$. Формула Тейлора одной переменной для $g$ на $[0,1]$ и равенство $f(b)-f(a)=g(1)-g(0)$ дают конечную формулу Тейлора для $f$.

Дополнение

На лекции это не было сказано (на доске начато «Remark», текст не виден). Матрица вторых производных $H_{ij}=\frac{\partial^2f}{\partial x^i\partial x^j}$ называется матрицей Гессе; для дважды непрерывно дифференцируемой $f$ она симметрична. Тогда $g''(t)=(b-a)^tH(b-a)$ и

$$f(b)=f(a)+Df(a)(b-a)+\tfrac12(b-a)^tH(\xi)(b-a),\qquad \xi=(1-\tau)a+\tau b,\ \tau\in(0,1).$$

Пример. $f(x)=x^1x^2$, $a=(0,0)^t$, $b=(1,2)^t$. Здесь $H=\begin{pmatrix}0&1\\1&0\end{pmatrix}$ и $(b-a)^tH(b-a)=2\cdot1\cdot2=4$. Проверка: $g(t)=t\cdot2t=2t^2$, $g''(t)=4$.

Зачем это в ML

Квадратичный член $\frac12u^tHu$ описывает кривизну функции потерь. Из-за него слишком большой шаг градиентного спуска перескакивает минимум, а метод Ньютона делит шаг на кривизну.

Замена переменных: полярные координаты

Пусть $f(x,y)$ — функция на плоскости, и $x=r\cos\theta$, $y=r\sin\theta$. Функция $F(r,\theta)=f(r\cos\theta,r\sin\theta)$ — композиция, и на доске цепное правило дало

$$\frac{\partial f}{\partial r}=\frac{\partial f}{\partial x}\cos\theta+\frac{\partial f}{\partial y}\sin\theta,\qquad \frac{\partial f}{\partial\theta}=\frac{\partial f}{\partial x}(-r\sin\theta)+\frac{\partial f}{\partial y}\,r\cos\theta.$$

В матричной форме это строка, умноженная на матрицу производной замены:

$$\Big(\frac{\partial f}{\partial r},\ \frac{\partial f}{\partial\theta}\Big)=\Big(\frac{\partial f}{\partial x},\ \frac{\partial f}{\partial y}\Big)\begin{pmatrix}\cos\theta&-r\sin\theta\\ \sin\theta&r\cos\theta\end{pmatrix}.$$

Пример. $f(x,y)=x^2+y^2$. Тогда $\frac{\partial f}{\partial r}=2x\cos\theta+2y\sin\theta=2r$ и $\frac{\partial f}{\partial\theta}=-2xr\sin\theta+2yr\cos\theta=0$. Проверка: $F(r,\theta)=r^2$ от $\theta$ не зависит.

Обратная задача (первая часть пункта 2 домашнего задания) — выразить $\partial f/\partial x$ и $\partial f/\partial y$ через $\partial f/\partial r$, $\partial f/\partial\theta$: это система $2\times2$ с матрицей выше.

Вторые производные. Коротко: $f_x=\partial f/\partial x$, $f_{xy}=\partial^2f/\partial x\partial y$. Главное правило: $f_x$ — тоже функция от $x,y$, а значит, через замену — от новых переменных. Для любой замены $x=x(s,t)$, $y=y(s,t)$

$$\frac{\partial}{\partial s}\Big[f_x\big(x(s,t),y(s,t)\big)\Big]=f_{xx}\,\frac{\partial x}{\partial s}+f_{xy}\,\frac{\partial y}{\partial s}.$$

А произведение $f_x\cdot\frac{\partial x}{\partial s}$ дифференцируется по правилу произведения: второе слагаемое $f_x\,\frac{\partial^2x}{\partial s^2}$ пропадает, только когда $\frac{\partial^2x}{\partial s^2}=0$ (например, у линейной замены; у полярной — при дифференцировании по $r$, но не по $\theta$).

Слагаемое, которое теряют

Частая ошибка во второй производной — продифференцировать только $f_x$ и забыть про коэффициент замены. У полярных координат коэффициент $\partial x/\partial\theta=-r\sin\theta$ сам зависит от $\theta$, поэтому в $\partial^2f/\partial\theta^2$ появятся первые производные $f_x$, $f_y$. Проверка: возьми $f$, для которой ответ известен заранее (например, $x^2+y^2=r^2$), и подставь.

Лектор назвал эти выкладки проверкой: кто проводит их без ошибок, тот владеет цепным правилом.

Зачем это в ML

Замена переменных в модели (нормировка признаков, переход к логарифмам, другая параметризация весов) меняет градиент ровно по этому правилу: строка производных умножается на матрицу производной замены.

Оптимизация: что можно минимизировать

Две оговорки лектора. Целевая функция должна быть вещественной: сравнивать по величине можно только вещественные числа; у векторов и даже у комплексных чисел пригодного порядка нет. Область определения теперь важна: дифференциальное исчисление локально, а вопрос о минимуме зависит от того, где область кончается.

Теорема Ферма

Теорема Ферма (необходимое условие)

Пусть $f:D\to\R$, $D\subseteq\R^N$, принимает наименьшее (или наибольшее) значение на $D$ в точке $x_0$, производная $Df(x_0)$ существует и $x_0$ — внутренняя точка $D$. Тогда $Df(x_0)=0$, то есть все частные производные в $x_0$ равны нулю.

Внутренняя точка

$x_0$ — внутренняя точка $D$, если есть $\varepsilon>0$, при котором открытый шар $B(x_0,\varepsilon)=\{x:\lVert x-x_0\rVert<\varepsilon\}$ целиком лежит в $D$.

Каждая точка интервала $(0,1)$ внутренняя; точка $0$ для отрезка $[0,1]$ — нет: любой шар вокруг неё вылезает влево. Лектор привёл контрпример без условия «внутренняя»: линейную функцию на $[0,1]$ (в записи слышно «twice», вероятно $f(x)=2x$). Минимум в $x=0$, а $f'(0)=2\ne0$ — потому что $0$ лежит на границе.

Идея доказательства. Для каждого направления $u$ функция $g(t)=f(x_0+tu)$ имеет минимум при $t=0$, и $0$ — внутренняя точка её области. По теореме Ферма одной переменной $g'(0)=Df(x_0)\,u=0$ для всех $u$, значит $Df(x_0)=0$. Полное доказательство — задача m0209.

Необходимое — не значит достаточное

$f(x)=x^3$ на $[-1,1]$: $f'(0)=0$, но в нуле нет ни минимума, ни максимума, а минимум достигается в $x=-1$. Условие $Df=0$ только сужает поиск: кандидаты — точки с $Df=0$ внутри области и отдельно граница.

Зачем это в ML

Градиент функции потерь равен нулю и в минимумах, и в максимумах, и в седловых точках. Поэтому «градиентный спуск остановился» ещё не значит «найден минимум».

Наименьшие квадраты

Дано $A\in M_{D\times N}$, $b\in\R^D$; ищем минимум $f(x)=\lVert b-Ax\rVert^2$ по $x\in\R^N$. Область — всё $\R^N$, поэтому каждая точка внутренняя. Совет лектора: минимизируй квадрат расстояния, а не расстояние — точка минимума та же, а функция гладкая. Из лекции 1 $Df(x)=-2(b-Ax)^tA$; приравниваем нулю, как на доске:

$$-2(b-Ax)^tA=0\ \Rightarrow\ -2(b-Ax)^t(A^t)^t=0\ \Rightarrow\ -2(A^tb-A^tAx)^t=0\ \Rightarrow\ A^tb-A^tAx=0.$$
Нормальные уравнения

Точка минимума $\lVert b-Ax\rVert^2$ удовлетворяет системе $A^tAx=A^tb$ размера $N\times N$.

Пример. Приблизим три числа $1, 2, 6$ одной константой $x$: $A=(1,1,1)^t$, $b=(1,2,6)^t$. Тогда $A^tA=3$, $A^tb=9$, $x=3$ — среднее арифметическое. Проверка: невязка $b-Ax=(-2,-1,3)^t$ ортогональна столбцу $A$, сумма её координат равна $0$.

Лектор перечислил вопросы, которые нужно задать всегда. Существует ли минимум? Здесь да; а максимума нет: при $A\ne0$ функция уходит в бесконечность. Есть ли у уравнения решение? Единственно ли оно? Для наименьших квадратов решение есть всегда, может быть не единственным, и любое решение даёт минимум. Доказательство лектор отложил до линейной алгебры.

Зачем это в ML

Строки $A$ — объекты, столбцы — признаки, $b$ — ответы. Нормальные уравнения дают веса линейной регрессии без градиентного спуска. Если два признака коллинеарны, $A^tA$ вырождена, и решение перестаёт быть единственным.

Ограничения: геометрия Лагранжа

Задача с доски. Дан треугольник $ABC$. Точки $P$ с $\lvert PA\rvert+\lvert PB\rvert=d_1$ образуют эллипс с фокусами $A$, $B$ — это кривая ограничения. Найти минимум $\lvert PC\rvert$ (целевой функции) на этом эллипсе. Если $d_1=\lvert AB\rvert$, эллипс вырождается в отрезок $AB$, и ответ — расстояние от $C$ до отрезка.

Ответ. Минимум достигается в точке $P_0$, где отрезок $CP_0$ ортогонален эллипсу, то есть касательной к нему.

Переформулировка. Множества уровня целевой функции $\{P:\lvert PC\rvert=\text{const}\}$ — окружности с центром $C$. Радиус перпендикулярен касательной к окружности, поэтому «$CP_0$ ортогонален эллипсу» значит: линия уровня целевой функции через $P_0$ касается кривой ограничения.

Почему это необходимо. Если линия уровня пересекает кривую ограничения, а не касается её, то движение вдоль ограничения в одну сторону уменьшает целевую функцию, а в другую — увеличивает. Значит, $P_0$ не минимум и не максимум. Это и есть геометрическая форма метода множителей Лагранжа.

По оптическому свойству эллипса касательная образует равные углы с отрезками до фокусов, поэтому $CP_0\perp$ эллипсу $\iff\angle AP_0C=\angle BP_0C$. Отсюда точка Ферма: минимум $\lvert PA\rvert+\lvert PB\rvert+\lvert PC\rvert$ может быть только там, где все три угла при $P$ равны $120°$, если минимум не в вершине треугольника (в вершине $\lvert PA\rvert$ не дифференцируема). Это снова необходимое условие: существование минимума нужно знать отдельно.

Теорема о множителях Лагранжа

Теорема Лагранжа (необходимое условие)

Пусть $f$ на множестве $\{x\in\R^N: g_1(x)=0,\dots,g_r(x)=0\}$, $r<N$, принимает наименьшее или наибольшее значение в точке $x_0$, функции гладкие, а матрица Якоби отображения $(g_1,\dots,g_r)$ в $x_0$ имеет полный ранг $r$. Тогда существуют числа $\lambda_1,\dots,\lambda_r$ (множители Лагранжа), для которых

$$\nabla f(x_0)=\lambda_1\nabla g_1(x_0)+\dots+\lambda_r\nabla g_r(x_0).$$

Формулировка записана по аудио: на фотографиях доски её нет. Условие $r<N$: при $r\ge N$ ограничения обычно оставляют лишь отдельные точки. Перевести геометрическое условие касания в эту формулу лектор оставил как упражнение — это пункт 5 домашнего задания. Лектор: «геометрия — ангел, алгебра — дьявол, но с ангелом вечно не проживёшь».

Счёт уравнений. Неизвестных $N+r$: координаты $x^1,\dots,x^N$ и множители $\lambda_1,\dots,\lambda_r$. Уравнений столько же: $N$ из векторного равенства и $r$ ограничений.

Вход, решение. $f(x)=(x^1)^2+2(x^2)^2$, $g(x)=x^1+x^2-3$. Ранг строки $Dg=(1,\ 1)$ равен $1$. Условие $\nabla f=\lambda\nabla g$: $2x^1=\lambda$, $4x^2=\lambda$, значит $x^1=2x^2$. Из ограничения $3x^2=3$, $x^2=1$, $x^1=2$, $f=4+2=6$. Проверка подстановкой $x^1=3-x^2$: $(3-x^2)^2+2(x^2)^2$ имеет производную $6x^2-6$, ноль при $x^2=1$. Минимум существует: на прямой $f\to\infty$ в обе стороны.

Зачем это в ML

Ограничения в ML повсюду: вероятности в сумме дают $1$, норма весов ограничена, в методе опорных векторов отступы не меньше $1$. Множители Лагранжа — общий способ решать такие задачи.

Максимум энтропии

Пример лектора: минимизировать $f(x)=\sum_{i=1}^{N}x^i\ln x^i$ при $x^i\in[0,1]$ и ограничении $\sum_ix^i=1$.

Граница. При $x^i=0$ логарифма нет. По Лопиталю $x\ln x=\frac{\ln x}{1/x}$, и $\lim_{x\to0^+}\frac{1/x}{-1/x^2}=\lim_{x\to0^+}(-x)=0$. Поэтому полагают $0\ln0=0$, и $f$ непрерывна вплоть до границы.

Условие Лагранжа. $\nabla f=(\ln x^i+1)_i$, $\nabla g=(1,\dots,1)^t$. Равенство $\nabla f=\lambda\nabla g$ даёт $\ln x^i+1=\lambda$ для каждого $i$, то есть все $x^i$ равны. Это $N$ уравнений, вместе с ограничением $N+1$ на $N+1$ неизвестных. Ответ: $x^i=1/N$.

Смысл

Числа $x^i$ образуют распределение вероятностей, а $H(x)=-\sum_ix^i\ln x^i$ — его энтропия. Минимум $\sum x^i\ln x^i$ — это максимум энтропии, и кандидат — равномерное распределение. Что это действительно минимум, лектор обещал показать позже.

Зачем это в ML

Перекрёстная энтропия — стандартная функция потерь классификатора. Если к условию $\sum p^i=1$ добавить ограничение на среднее, максимум энтропии даёт $p^i$, пропорциональные $e^{\lambda k_i}$, — форму softmax (финал m0220).

Что должно остаться в голове

  1. Производная — линейное отображение; для $f:M_{m\times n}\to\R$ она записывается матрицей $Df(X_0)\in M_{n\times m}$, действующей по правилу $U\mapsto\tr(Df(X_0)\,U)$.
  2. $D(F\circ G)=DF\cdot DG$: композиция нелинейных отображений переходит в произведение матриц.
  3. Сужение на прямую или отрезок, $g(t)=f(x_0+tu)$, сводит многомерный вопрос к одной переменной: $g'(0)=Df(x_0)\,u$.
  4. $g''$ на отрезке — квадратичная форма $(b-a)^tH(b-a)$; отсюда второй порядок Тейлора.
  5. При замене переменных строка производных умножается на матрицу производной замены; во вторых производных дифференцируй и $f_x$, и коэффициенты замены.
  6. $Df=0$ — только необходимое условие и только во внутренних точках; границу проверяют отдельно.
  7. Минимум $\lVert b-Ax\rVert^2$: нормальные уравнения $A^tAx=A^tb$.
  8. С ограничениями: $\nabla f=\sum\lambda_i\nabla g_i$ при полном ранге; уравнений $N+r$, неизвестных $N+r$.
  9. Максимум энтропии при одном ограничении $\sum p^i=1$ — равномерное распределение.
EN

Entry: a minimum on a line

Take the function $f(x)=(x^1)^2+2(x^2)^2$ on the plane. Where is it smallest if the point must lie on the line $x^1+x^2=3$? Without the constraint the answer is the origin, but the origin is not on the line. To answer, you need three things from today’s lecture: the derivative along a line (chain rule), the condition “the derivative is zero” (Fermat’s theorem), and a way to take the constraint into account (Lagrange multipliers). The answer is at the end of the Lagrange section.

The derivative is a linear map

The lecture began with a clarification. A matrix $A\in M_{D\times N}$ defines the map $u\mapsto Au$, and this map is linear: $A(u+v)=Au+Av$, $A(\lambda u)=\lambda Au$. Every linear map $\R^N\to\R^D$ is written by such a matrix. So in the definition from lecture 1

$$f(x_0+u)-f(x_0)=Df(x_0)\,u+o(\lVert u\rVert)$$

the derivative $Df(x_0)$ is by nature a linear map, and the matrix is a way to write it down.

How you write it is a choice, like choosing a coordinate system. Linear functions $\R^N\to\R$ are written as rows: the row $a^t$ acts by $u\mapsto a^tu$. So when $D=1$, the derivative is a row. If the argument is a matrix, a different way of writing is needed.

Derivative of a function of a matrix (the lecturer’s convention)

A linear function $M_{m\times n}\to\R$ is written as a matrix $C\in M_{n\times m}$ acting by $U\mapsto\tr(CU)$. For $f:M_{m\times n}\to\R$ the derivative $Df(X_0)\in M_{n\times m}$ is defined by

$$f(X_0+U)-f(X_0)=\tr\big(Df(X_0)\,U\big)+o(\lVert U\rVert).$$

Working form: if $\lim_{h\to0}\frac{f(X_0+hU)-f(X_0)}{h}=\tr(ZU)$ for every $U$ and $f$ is differentiable, then $Z=Df(X_0)$.

The sizes match: $C$ is $n\times m$, $U$ is $m\times n$, the product $CU$ is a square $n\times n$ matrix, and it has a trace. The lecturer said it plainly: “this is my convention.” It explains the answer $b\,a^t$ for $f(X)=a^tXb$ from lecture 1: there $a^tUb=\tr(a^tUb)=\tr(b\,a^tU)$.

Example. $f(X)=\tr(X^tX)=\lVert X\rVert^2$, $X\in M_{m\times n}$. Substitute $X_0+hU$ and expand:

$$f(X_0+hU)=\tr(X_0^tX_0)+h\,\tr(U^tX_0)+h\,\tr(X_0^tU)+h^2\tr(U^tU).$$

A matrix and its transpose have the same trace, so $\tr(U^tX_0)=\tr\big((X_0^tU)^t\big)=\tr(X_0^tU)$. Divide the difference by $h$ and let $h\to0$: what remains is $2\tr(X_0^tU)$. Hence $Df(X_0)=2X_0^t$, of size $n\times m$.

The transpose that gets lost

Machine learning libraries store the gradient with respect to a weight matrix $W$ in the shape of $W$ itself. That is $(Df)^t$, not $Df$. Within one solution, keep one convention: in this course $Df(X_0)$ stands to the left of $U$ under the trace. Size check: for $X\in M_{m\times n}$ the matrix $Df(X_0)$ must have size $n\times m$.

Why this matters for ML

A network layer is $x\mapsto Wx$ with a weight matrix $W$. A training step changes $W$ by $-\eta\,(Df)^t$, so the derivative with respect to a matrix is computed for every layer at every step.

Proof of the chain rule

The idea in one sentence: give $t$ an increment $\Delta t$, see how far $u$ moved (that is $\Delta u$), and how much $f$ changed. The lecturer treated the essential case: $y=f(u^1,\dots,u^N)$, $u^j=g_j(t)$, the derivative $Df(u_0)$ exists, every $g_j'(t_0)$ exists, $u_0=g(t_0)$.

Step 1. The helper function $G$. By the definition of the derivative $f(u_0+\Delta u)-f(u_0)=Df(u_0)\Delta u+o(\lVert\Delta u\rVert)$. Define

$$G(\Delta u)=\begin{cases}\dfrac{f(u_0+\Delta u)-f(u_0)-Df(u_0)\Delta u}{\lVert\Delta u\rVert}, & \Delta u\neq0,\\[4pt] 0, & \Delta u=0.\end{cases}$$

Then $\lim_{\Delta u\to0}G(\Delta u)=0$, and the equality

$$f(u_0+\Delta u)-f(u_0)=Df(u_0)\Delta u+G(\Delta u)\,\lVert\Delta u\rVert$$

holds for every $\Delta u$: for $\Delta u\ne0$ it is the definition of $G$ multiplied by $\lVert\Delta u\rVert$, and for $\Delta u=0$ both sides are zero.

Why $G$. Next we divide by $\Delta t$, and $\Delta u$ can be zero while $\Delta t\ne0$ (for example, if $g$ is constant near $t_0$). Dividing by $\lVert\Delta u\rVert$ is then impossible, while the form with $G$ covers this case.

Step 2. Substitute. Take $\Delta u=g(t_0+\Delta t)-g(t_0)$ and divide by $\Delta t$:

$$\frac{f(g(t_0+\Delta t))-f(g(t_0))}{\Delta t}=\sum_{j=1}^{N}\frac{\partial f}{\partial u^j}(u_0)\,\frac{g_j(t_0+\Delta t)-g_j(t_0)}{\Delta t}+G(\Delta u)\frac{\lVert\Delta u\rVert}{\Delta t}.$$

Step 3. The extra term goes to zero. Its absolute value is $\lvert G(\Delta u)\rvert\cdot\big\lVert\frac{\Delta u}{\Delta t}\big\rVert$. Each $g_j$ is differentiable, hence continuous, so $\Delta u\to0$ and $G(\Delta u)\to0$. The second factor tends to the length of the finite vector $(g_1'(t_0),\dots,g_N'(t_0))^t$. The product tends to zero, and

$$\left.\frac{dy}{dt}\right|_{t_0}=\sum_{j=1}^{N}\frac{\partial f}{\partial u^j}(u_0)\,g_j'(t_0).\qquad\blacksquare$$

For $N=1$ this is the same proof of the ordinary chain rule.

The chain rule in general form

For maps $G:\R^N\to\R^M$ and $F:\R^M\to\R^D$ (here $G$ is another map, not the function from the proof)

$$D(F\circ G)(x_0)=DF\big(G(x_0)\big)\,DG(x_0).$$

On the right is a composition of linear maps; in matrices, a product of sizes $(D\times M)(M\times N)$.

The lecturer: the derivative is so important because it turns a composition of nonlinear maps into a composition of linear ones and keeps the composition itself.

Why this matters for ML

Backpropagation is exactly this formula for a network with many layers: the layers’ Jacobian matrices are multiplied, starting from the last layer.

Directional derivative

Let $g(t)=f(x_0+tu)$: this is $f$ restricted to the line through $x_0$ with direction $u$. The inner function $t\mapsto x_0+tu$ has derivative $u$, so by the chain rule

$$g'(0)=Df(x_0)\,u=\langle\nabla f(x_0),u\rangle.$$

This is the directional derivative: the rate of change of $f$ when the point moves only along this line.

Example. $f(x)=(x^1)^2x^2$, $x_0=(1,2)^t$, $u=(1,1)^t$. The partial derivatives are $2x^1x^2=4$ and $(x^1)^2=1$, so $Df(x_0)=(4,\ 1)$ and $g'(0)=4\cdot1+1\cdot1=5$. Check by substitution: $g(t)=(1+t)^2(2+t)$, $g'(t)=2(1+t)(2+t)+(1+t)^2$, $g'(0)=4+1=5$.

Two mistakes the lecturer corrected at the board

Do not write $f'$ for a multivariable function — write $Df$. Order matters: $u$ stands to the right of $Df(x_0)$, because this is a matrix product. And the derivative is taken at $t=0$: no $t$ may remain in the answer.

If the point moves along a curve $\gamma(t)$ instead of a line, then in the same way $\frac{d}{dt}f(\gamma(t))=Df(\gamma(t))\,\gamma'(t)$.

Taylor for a multivariable function

Take $f:\R^N\to\R$ and points $a,b\in\R^N$. Restrict $f$ to the segment between them:

$$g(t)=f\big((1-t)a+tb\big),\qquad t\in[0,1].$$

The inner function has derivative $b-a$. All partial derivatives below are evaluated at the point $(1-t)a+tb$:

$$g'(t)=\sum_{i=1}^{N}\frac{\partial f}{\partial x^i}\,(b^i-a^i),$$$$g''(t)=\sum_{i=1}^{N}\sum_{j=1}^{N}\frac{\partial^2 f}{\partial x^j\partial x^i}\,(b^j-a^j)(b^i-a^i),$$$$g'''(t)=\sum_{k=1}^{N}\sum_{j=1}^{N}\sum_{i=1}^{N}\frac{\partial^3 f}{\partial x^k\partial x^j\partial x^i}\,(b^k-a^k)(b^j-a^j)(b^i-a^i).$$

Each new derivative adds one more sum and one more factor of the form $(b-a)$: the same chain rule is applied to $g'$, only with $\partial f/\partial x^i$ in place of $f$. Taylor’s formula in one variable for $g$ on $[0,1]$ and the equality $f(b)-f(a)=g(1)-g(0)$ give the finite Taylor formula for $f$.

Not from the lecture

This was not said in class (the board shows a started “Remark” whose text is not visible). The matrix of second derivatives $H_{ij}=\frac{\partial^2f}{\partial x^i\partial x^j}$ is called the Hessian matrix; for a twice continuously differentiable $f$ it is symmetric. Then $g''(t)=(b-a)^tH(b-a)$ and

$$f(b)=f(a)+Df(a)(b-a)+\tfrac12(b-a)^tH(\xi)(b-a),\qquad \xi=(1-\tau)a+\tau b,\ \tau\in(0,1).$$

Example. $f(x)=x^1x^2$, $a=(0,0)^t$, $b=(1,2)^t$. Here $H=\begin{pmatrix}0&1\\1&0\end{pmatrix}$ and $(b-a)^tH(b-a)=2\cdot1\cdot2=4$. Check: $g(t)=t\cdot2t=2t^2$, $g''(t)=4$.

Why this matters for ML

The quadratic term $\frac12u^tHu$ describes the curvature of the loss. Because of it, a gradient descent step that is too large overshoots the minimum, and Newton’s method divides the step by the curvature.

Change of variables: polar coordinates

Let $f(x,y)$ be a function on the plane, and $x=r\cos\theta$, $y=r\sin\theta$. The function $F(r,\theta)=f(r\cos\theta,r\sin\theta)$ is a composition, and on the board the chain rule gave

$$\frac{\partial f}{\partial r}=\frac{\partial f}{\partial x}\cos\theta+\frac{\partial f}{\partial y}\sin\theta,\qquad \frac{\partial f}{\partial\theta}=\frac{\partial f}{\partial x}(-r\sin\theta)+\frac{\partial f}{\partial y}\,r\cos\theta.$$

In matrix form, this is a row multiplied by the derivative matrix of the change of variables:

$$\Big(\frac{\partial f}{\partial r},\ \frac{\partial f}{\partial\theta}\Big)=\Big(\frac{\partial f}{\partial x},\ \frac{\partial f}{\partial y}\Big)\begin{pmatrix}\cos\theta&-r\sin\theta\\ \sin\theta&r\cos\theta\end{pmatrix}.$$

Example. $f(x,y)=x^2+y^2$. Then $\frac{\partial f}{\partial r}=2x\cos\theta+2y\sin\theta=2r$ and $\frac{\partial f}{\partial\theta}=-2xr\sin\theta+2yr\cos\theta=0$. Check: $F(r,\theta)=r^2$ does not depend on $\theta$.

The inverse problem (the first part of homework item 2) is to express $\partial f/\partial x$ and $\partial f/\partial y$ through $\partial f/\partial r$, $\partial f/\partial\theta$: this is a $2\times2$ system with the matrix above.

Second derivatives. Shorthand: $f_x=\partial f/\partial x$, $f_{xy}=\partial^2f/\partial x\partial y$. The main rule: $f_x$ is also a function of $x,y$, and therefore, through the change of variables, of the new variables. For any change $x=x(s,t)$, $y=y(s,t)$

$$\frac{\partial}{\partial s}\Big[f_x\big(x(s,t),y(s,t)\big)\Big]=f_{xx}\,\frac{\partial x}{\partial s}+f_{xy}\,\frac{\partial y}{\partial s}.$$

And the product $f_x\cdot\frac{\partial x}{\partial s}$ is differentiated by the product rule: the second term $f_x\,\frac{\partial^2x}{\partial s^2}$ vanishes only when $\frac{\partial^2x}{\partial s^2}=0$ (for example, for a linear change; for the polar one, when differentiating in $r$ but not in $\theta$).

The term that gets lost

A common mistake in a second derivative is to differentiate only $f_x$ and forget the coefficient of the change. In polar coordinates the coefficient $\partial x/\partial\theta=-r\sin\theta$ itself depends on $\theta$, so $\partial^2f/\partial\theta^2$ will contain the first derivatives $f_x$, $f_y$. Check: take an $f$ whose answer you know in advance (for example, $x^2+y^2=r^2$) and substitute.

The lecturer called these computations a test: whoever carries them out without mistakes can handle the chain rule.

Why this matters for ML

A change of variables in a model (feature scaling, switching to logarithms, a different parametrization of the weights) changes the gradient exactly by this rule: the row of derivatives is multiplied by the derivative matrix of the change.

Optimization: what can be minimized

Two caveats from the lecturer. The objective function must be real-valued: only real numbers can be compared by size; vectors and even complex numbers have no usable order. The domain matters now: differential calculus is local, while the question of a minimum depends on where the domain ends.

Fermat’s theorem

Fermat’s theorem (necessary condition)

Suppose $f:D\to\R$, $D\subseteq\R^N$, attains its smallest (or largest) value on $D$ at a point $x_0$, the derivative $Df(x_0)$ exists, and $x_0$ is an interior point of $D$. Then $Df(x_0)=0$, that is, all partial derivatives at $x_0$ are zero.

Interior point

$x_0$ is an interior point of $D$ if there is $\varepsilon>0$ such that the open ball $B(x_0,\varepsilon)=\{x:\lVert x-x_0\rVert<\varepsilon\}$ lies entirely in $D$.

Every point of the open interval $(0,1)$ is interior; the point $0$ of the segment $[0,1]$ is not: every ball around it sticks out to the left. The lecturer gave a counterexample without the “interior” condition: a linear function on $[0,1]$ (the recording sounds like “twice”, probably $f(x)=2x$). The minimum is at $x=0$, but $f'(0)=2\ne0$ — because $0$ lies on the boundary.

Proof idea. For each direction $u$ the function $g(t)=f(x_0+tu)$ has a minimum at $t=0$, and $0$ is an interior point of its domain. By Fermat’s theorem in one variable $g'(0)=Df(x_0)\,u=0$ for all $u$, hence $Df(x_0)=0$. The full proof is problem m0209.

Necessary does not mean sufficient

$f(x)=x^3$ on $[-1,1]$: $f'(0)=0$, but there is neither a minimum nor a maximum at zero, and the minimum is attained at $x=-1$. The condition $Df=0$ only narrows the search: the candidates are points with $Df=0$ inside the domain, plus the boundary separately.

Why this matters for ML

The gradient of the loss is zero at minima, at maxima, and at saddle points. So “gradient descent stopped” does not yet mean “a minimum was found.”

Least squares

Given $A\in M_{D\times N}$, $b\in\R^D$, we look for the minimum of $f(x)=\lVert b-Ax\rVert^2$ over $x\in\R^N$. The domain is all of $\R^N$, so every point is interior. The lecturer’s advice: minimize the squared distance, not the distance — the minimizer is the same, and the function is smooth. From lecture 1 $Df(x)=-2(b-Ax)^tA$; set it to zero, as on the board:

$$-2(b-Ax)^tA=0\ \Rightarrow\ -2(b-Ax)^t(A^t)^t=0\ \Rightarrow\ -2(A^tb-A^tAx)^t=0\ \Rightarrow\ A^tb-A^tAx=0.$$
Normal equations

The minimizer of $\lVert b-Ax\rVert^2$ satisfies the $N\times N$ system $A^tAx=A^tb$.

Example. Approximate the three numbers $1, 2, 6$ by one constant $x$: $A=(1,1,1)^t$, $b=(1,2,6)^t$. Then $A^tA=3$, $A^tb=9$, $x=3$ — the arithmetic mean. Check: the residual $b-Ax=(-2,-1,3)^t$ is orthogonal to the column of $A$; the sum of its coordinates is $0$.

The lecturer listed the questions you must always ask. Does a minimum exist? Here, yes; but there is no maximum: for $A\ne0$ the function goes to infinity. Does the equation have a solution? Is it unique? For least squares a solution always exists, it may be non-unique, and any solution gives the minimum. The lecturer postponed the proof to the linear algebra part.

Why this matters for ML

The rows of $A$ are objects, the columns are features, $b$ holds the targets. The normal equations give the weights of linear regression without gradient descent. If two features are collinear, $A^tA$ is singular, and the solution stops being unique.

Constraints: Lagrange geometry

The problem from the board. A triangle $ABC$ is given. The points $P$ with $\lvert PA\rvert+\lvert PB\rvert=d_1$ form an ellipse with foci $A$, $B$ — this is the constraint curve. Find the minimum of $\lvert PC\rvert$ (the objective function) on this ellipse. If $d_1=\lvert AB\rvert$, the ellipse degenerates into the segment $AB$, and the answer is the distance from $C$ to the segment.

Answer. The minimum is attained at the point $P_0$ where the segment $CP_0$ is orthogonal to the ellipse, that is, to its tangent line.

Reformulation. The level sets of the objective $\{P:\lvert PC\rvert=\text{const}\}$ are circles centered at $C$. A radius is perpendicular to the tangent of the circle, so “$CP_0$ is orthogonal to the ellipse” means: the level curve of the objective through $P_0$ is tangent to the constraint curve.

Why this is necessary. If the level curve crosses the constraint curve instead of touching it, then moving along the constraint one way lowers the objective, and moving the other way raises it. So $P_0$ is neither a minimum nor a maximum. This is the geometric form of the Lagrange multiplier method.

By the reflection property of the ellipse, the tangent makes equal angles with the segments to the foci, so $CP_0\perp$ ellipse $\iff\angle AP_0C=\angle BP_0C$. This gives the Fermat point: the minimum of $\lvert PA\rvert+\lvert PB\rvert+\lvert PC\rvert$ can only be where all three angles at $P$ equal $120°$, unless the minimum is at a vertex of the triangle (at a vertex, $\lvert PA\rvert$ is not differentiable). Again a necessary condition: the existence of the minimum must be known separately.

The Lagrange multiplier theorem

Lagrange’s theorem (necessary condition)

Suppose $f$ on the set $\{x\in\R^N: g_1(x)=0,\dots,g_r(x)=0\}$, $r<N$, attains its smallest or largest value at a point $x_0$, the functions are smooth, and the Jacobian matrix of the map $(g_1,\dots,g_r)$ at $x_0$ has full rank $r$. Then there are numbers $\lambda_1,\dots,\lambda_r$ (Lagrange multipliers) such that

$$\nabla f(x_0)=\lambda_1\nabla g_1(x_0)+\dots+\lambda_r\nabla g_r(x_0).$$

The statement is taken from the audio: it is not on the board photos. The condition $r<N$: for $r\ge N$ the constraints usually leave only isolated points. The lecturer left translating the geometric tangency condition into this formula as an exercise — it is item 5 of the homework. The lecturer: “geometry is the angel and algebra is the devil, but you cannot live with an angel forever.”

Counting equations. There are $N+r$ unknowns: the coordinates $x^1,\dots,x^N$ and the multipliers $\lambda_1,\dots,\lambda_r$. There are as many equations: $N$ from the vector equality and $r$ constraints.

Entry, solved. $f(x)=(x^1)^2+2(x^2)^2$, $g(x)=x^1+x^2-3$. The rank of the row $Dg=(1,\ 1)$ is $1$. The condition $\nabla f=\lambda\nabla g$: $2x^1=\lambda$, $4x^2=\lambda$, so $x^1=2x^2$. From the constraint $3x^2=3$, $x^2=1$, $x^1=2$, $f=4+2=6$. Check by substituting $x^1=3-x^2$: $(3-x^2)^2+2(x^2)^2$ has derivative $6x^2-6$, which is zero at $x^2=1$. The minimum exists: along the line $f\to\infty$ in both directions.

Why this matters for ML

Constraints are everywhere in ML: probabilities sum to $1$, the norm of the weights is bounded, in support vector machines the margins are at least $1$. Lagrange multipliers are the general way to solve such problems.

Maximum entropy

The lecturer’s example: minimize $f(x)=\sum_{i=1}^{N}x^i\ln x^i$ over $x^i\in[0,1]$ subject to $\sum_ix^i=1$.

The boundary. At $x^i=0$ the logarithm is undefined. By L’Hôpital, $x\ln x=\frac{\ln x}{1/x}$, and $\lim_{x\to0^+}\frac{1/x}{-1/x^2}=\lim_{x\to0^+}(-x)=0$. So one sets $0\ln0=0$, and $f$ is continuous up to the boundary.

The Lagrange condition. $\nabla f=(\ln x^i+1)_i$, $\nabla g=(1,\dots,1)^t$. The equality $\nabla f=\lambda\nabla g$ gives $\ln x^i+1=\lambda$ for every $i$, so all $x^i$ are equal. That is $N$ equations, together with the constraint $N+1$ for $N+1$ unknowns. The answer: $x^i=1/N$.

Meaning

The numbers $x^i$ form a probability distribution, and $H(x)=-\sum_ix^i\ln x^i$ is its entropy. The minimum of $\sum x^i\ln x^i$ is the maximum of entropy, and the candidate is the uniform distribution. That it really is the minimum, the lecturer promised to show later.

Why this matters for ML

Cross-entropy is the standard loss of a classifier. If a constraint on the mean is added to $\sum p^i=1$, maximum entropy gives $p^i$ proportional to $e^{\lambda k_i}$ — the softmax form (final m0220).

What should stay with you

  1. The derivative is a linear map; for $f:M_{m\times n}\to\R$ it is written as a matrix $Df(X_0)\in M_{n\times m}$ acting by $U\mapsto\tr(Df(X_0)\,U)$.
  2. $D(F\circ G)=DF\cdot DG$: a composition of nonlinear maps becomes a product of matrices.
  3. Restricting to a line or a segment, $g(t)=f(x_0+tu)$, reduces a multivariable question to one variable: $g'(0)=Df(x_0)\,u$.
  4. $g''$ on a segment is the quadratic form $(b-a)^tH(b-a)$; this gives second-order Taylor.
  5. Under a change of variables the row of derivatives is multiplied by the derivative matrix of the change; in second derivatives, differentiate both $f_x$ and the coefficients of the change.
  6. $Df=0$ is only a necessary condition and only at interior points; the boundary is checked separately.
  7. Minimum of $\lVert b-Ax\rVert^2$: the normal equations $A^tAx=A^tb$.
  8. With constraints: $\nabla f=\sum\lambda_i\nabla g_i$ under full rank; $N+r$ equations, $N+r$ unknowns.
  9. Maximum entropy with the single constraint $\sum p^i=1$ is the uniform distribution.

Признаки и действияTriggers and actions

Слева — что видно в условии. Справа — что сделать первым.Left: what you see in the statement. Right: the first move.

Что видноWhat you seeПервый ходFirst move
Нужна производная функции от матрицыYou need the derivative of a function of a matrixПодставь $X_0+hU$, оставь слагаемые первой степени по $h$ и сведи каждое к виду $\tr(ZU)$ циклической перестановкойSubstitute $X_0+hU$, keep the terms of first degree in $h$, and bring each to the form $\tr(ZU)$ by a cyclic permutation
Спрашивают, как меняется $f$ вдоль прямой, отрезка или кривойYou are asked how $f$ changes along a line, a segment, or a curveВведи $g(t)=f(\gamma(t))$ и примени цепное правило: $g'(t)=Df(\gamma(t))\,\gamma'(t)$Introduce $g(t)=f(\gamma(t))$ and apply the chain rule: $g'(t)=Df(\gamma(t))\,\gamma'(t)$
Производные известны в одних координатах, а нужны в другихDerivatives are known in one set of coordinates but needed in anotherВыпиши матрицу производной замены и реши систему $2\times2$Write the derivative matrix of the change and solve a $2\times2$ system
Нужна вторая производная сложной функцииYou need a second derivative of a composite functionДифференцируй каждую частную производную $f$ ещё раз по цепному правилу, а коэффициенты замены — по правилу произведенияDifferentiate each partial derivative of $f$ once more with the chain rule, and the coefficients of the change with the product rule
Ищут наибольшее или наименьшее значение на множестве с краемYou are asked for the largest or smallest value on a set with a boundaryКандидаты: точки с $Df=0$ внутри и отдельно граница; потом сравни значенияCandidates: points with $Df=0$ inside and the boundary separately; then compare the values
Минимизируют расстояние или нормуA distance or a norm is minimizedМинимизируй квадрат; для $\lVert b-Ax\rVert^2$ сразу пиши $A^tAx=A^tb$Minimize the square; for $\lVert b-Ax\rVert^2$ write $A^tAx=A^tb$ right away
Есть ограничения-равенства $g_i(x)=0$There are equality constraints $g_i(x)=0$Запиши $\nabla f=\sum\lambda_i\nabla g_i$, добавь ограничения, проверь ранг и сосчитай уравнения и неизвестныеWrite $\nabla f=\sum\lambda_i\nabla g_i$, add the constraints, check the rank, and count equations and unknowns
В целевой функции стоит $\sum x^i\ln x^i$The objective contains $\sum x^i\ln x^i$Это энтропия со знаком минус: положи $0\ln0=0$, градиент равен $(\ln x^i+1)_i$This is minus the entropy: set $0\ln0=0$; the gradient is $(\ln x^i+1)_i$
эталонная задачаmodel problem

Условный минимум с двумя ограничениямиA constrained minimum with two constraints

RU

Условие. Найти минимум $f(x,y,z)=x^2+y^2+z^2$ при ограничениях $x+y=2$ и $y+z=4$.

Та же схема решает m0204 и мост m0215, финал m0219 и финал m0220.

Шаг 1. Решить, что здесь целевая функция, что ограничения и какая область. Целевая функция $f$, ограничения $g_1=x+y-2=0$ и $g_2=y+z-4=0$, область — всё $\R^3$, края нет. Ограничений $r=2$ меньше числа переменных $N=3$: множество допустимых точек — прямая, а не отдельные точки.

Шаг 2. Решить, применима ли теорема: проверить ранг. Матрица Якоби ограничений

$$\begin{pmatrix}1&1&0\\0&1&1\end{pmatrix}$$

одна и та же во всех точках, её строки не пропорциональны, ранг $2=r$. Условие теоремы выполнено везде.

Шаг 3. Решить, существует ли минимум. Допустимое множество — прямая, и вдоль неё $f\to\infty$ в обе стороны. Значит, минимум есть, а максимума нет. Без этого шага найденная точка могла бы оказаться чем угодно.

Шаг 4. Записать систему и сосчитать уравнения.

$$\nabla f=\lambda_1\nabla g_1+\lambda_2\nabla g_2:\qquad 2x=\lambda_1,\quad 2y=\lambda_1+\lambda_2,\quad 2z=\lambda_2.$$

Вместе с двумя ограничениями — $5$ уравнений на $5$ неизвестных $x,y,z,\lambda_1,\lambda_2$.

Шаг 5. Выразить переменные через множители и подставить в ограничения. $x=\frac{\lambda_1}{2}$, $y=\frac{\lambda_1+\lambda_2}{2}$, $z=\frac{\lambda_2}{2}$. Ограничения:

$$x+y=\lambda_1+\frac{\lambda_2}{2}=2,\qquad y+z=\frac{\lambda_1}{2}+\lambda_2=4.$$

Из первого $\lambda_1=2-\frac{\lambda_2}{2}$; подставляем во второе: $1-\frac{\lambda_2}{4}+\lambda_2=4$, то есть $\frac34\lambda_2=3$, $\lambda_2=4$, $\lambda_1=0$. Отсюда $x=0$, $y=2$, $z=2$ и $f=0+4+4=8$.

Шаг 6. Проверить другим путём. Из ограничений $x=2-y$, $z=4-y$, и $f=(2-y)^2+y^2+(4-y)^2$. Производная по $y$: $-2(2-y)+2y-2(4-y)=6y-12$, ноль при $y=2$. Та же точка, то же значение $8$. Ограничения выполнены: $0+2=2$, $2+2=4$.

Алгоритм
  1. Назови целевую функцию, ограничения и область; убедись, что $r<N$.
  2. Проверь, что матрица Якоби ограничений имеет ранг $r$ в кандидатах.
  3. Выясни, существует ли минимум или максимум, до всяких вычислений.
  4. Запиши $\nabla f=\sum\lambda_i\nabla g_i$ и ограничения; сверь число уравнений и неизвестных.
  5. Вырази $x$ через $\lambda$, подставь в ограничения, найди $\lambda$, затем $x$.
  6. Проверь ограничения и сравни с решением подстановкой, если оно доступно.
EN

Problem. Find the minimum of $f(x,y,z)=x^2+y^2+z^2$ subject to $x+y=2$ and $y+z=4$.

The same scheme solves m0204 and the bridge m0215, the final m0219, and the final m0220.

Step 1. Decide what the objective, the constraints, and the domain are. The objective is $f$, the constraints are $g_1=x+y-2=0$ and $g_2=y+z-4=0$, the domain is all of $\R^3$, with no boundary. The number of constraints $r=2$ is less than the number of variables $N=3$: the feasible set is a line, not isolated points.

Step 2. Decide whether the theorem applies: check the rank. The Jacobian matrix of the constraints

$$\begin{pmatrix}1&1&0\\0&1&1\end{pmatrix}$$

is the same at every point, its rows are not proportional, and its rank is $2=r$. The condition of the theorem holds everywhere.

Step 3. Decide whether a minimum exists. The feasible set is a line, and along it $f\to\infty$ in both directions. So a minimum exists, and a maximum does not. Without this step the point we find could turn out to be anything.

Step 4. Write the system and count the equations.

$$\nabla f=\lambda_1\nabla g_1+\lambda_2\nabla g_2:\qquad 2x=\lambda_1,\quad 2y=\lambda_1+\lambda_2,\quad 2z=\lambda_2.$$

Together with the two constraints — $5$ equations for $5$ unknowns $x,y,z,\lambda_1,\lambda_2$.

Step 5. Express the variables through the multipliers and substitute into the constraints. $x=\frac{\lambda_1}{2}$, $y=\frac{\lambda_1+\lambda_2}{2}$, $z=\frac{\lambda_2}{2}$. The constraints:

$$x+y=\lambda_1+\frac{\lambda_2}{2}=2,\qquad y+z=\frac{\lambda_1}{2}+\lambda_2=4.$$

From the first, $\lambda_1=2-\frac{\lambda_2}{2}$; substitute into the second: $1-\frac{\lambda_2}{4}+\lambda_2=4$, that is, $\frac34\lambda_2=3$, $\lambda_2=4$, $\lambda_1=0$. Hence $x=0$, $y=2$, $z=2$ and $f=0+4+4=8$.

Step 6. Check by another route. From the constraints, $x=2-y$, $z=4-y$, and $f=(2-y)^2+y^2+(4-y)^2$. The derivative in $y$: $-2(2-y)+2y-2(4-y)=6y-12$, zero at $y=2$. The same point, the same value $8$. The constraints hold: $0+2=2$, $2+2=4$.

Algorithm
  1. Name the objective, the constraints, and the domain; make sure that $r<N$.
  2. Check that the Jacobian matrix of the constraints has rank $r$ at the candidates.
  3. Find out whether a minimum or maximum exists, before any computation.
  4. Write $\nabla f=\sum\lambda_i\nabla g_i$ and the constraints; compare the numbers of equations and unknowns.
  5. Express $x$ through $\lambda$, substitute into the constraints, find $\lambda$, then $x$.
  6. Check the constraints and compare with the solution by substitution when it is available.

Что подчеркнул лекторWhat the lecturer stressed

Время записано как часть:минуты:секунды; «—» — без точной метки.Time is recording part:minutes:seconds; “—” means no exact timestamp.

ВремяTimeЧто подчеркнулWhat was stressed
1:15:31Записывать производную по матрице матрицей другого размера — моё соглашение, как выбор системы координат; сама производная всегда линейное отображениеWriting the derivative with respect to a matrix as a matrix of a different size is my convention, like choosing a coordinate system; the derivative itself is always a linear map
1:37:43Форма с функцией $G$ нужна, чтобы покрыть исключительный случай: при $\Delta t\ne0$ приращение $\Delta u$ может быть нулёмThe form with the function $G$ is there to cover an exceptional case: when $\Delta t\ne0$, the increment $\Delta u$ can be zero
1:40:04Производная так фундаментальна, потому что превращает композицию нелинейных отображений в композицию линейных и сохраняет композициюThe derivative is so fundamental because it turns a composition of nonlinear maps into a composition of linear maps and preserves the composition
1:43:40Не пиши штрих для функции многих переменных; $u$ ставится справа, и производная берётся при $t=0$Do not use the prime for a multivariable function; $u$ goes on the right, and the derivative is taken at $t=0$
1:55:43Обозначения важны: когда запутаешься, тебя спасут обозначенияNotation is important: when you get lost, your notation will save you
2:07:16Полярный и сферический лапласиан — проверка цепного правила; возьми очень большой лист бумагиThe polar and spherical Laplacian is a test of the chain rule; get a very big sheet of paper
2:18:14Внутренняя точка — исключительно важное условие: без него теорема Ферма невернаThe interior point is an extremely important condition: without it Fermat’s theorem is false
2:24:15Когда просят минимум расстояния, всегда минимизируй квадрат расстоянияWhenever you are asked for a minimum distance, always minimize the squared distance
2:30:41Производная, равная нулю, не гарантирует минимума или максимума: она только сужает поискA zero derivative does not guarantee a minimum or maximum: it only narrows down your search
3:15:18Если линия уровня не касается кривой ограничения, вдоль ограничения можно сдвинуться к меньшему и к большему значению, поэтому касание необходимоIf the level curve is not tangent to the constraint curve, you can move along the constraint to a smaller and to a bigger value, so tangency is necessary
3:28:30Необходимое условие даёт ответ, только если заранее известно, что минимум существуетThe necessary condition gives you the answer only if you know in advance that the minimum exists
3:53:52Максимум энтропии — когда всё распределено равномерно, без исключенийMaximum entropy is when everything is evenly distributed, with no exceptions

Дополнительные материалыAdditional materials

Другие объяснения той же темы. Открывай их, если урока не хватило.Other explanations of the same topic. Open them if the lesson was not enough.

текстtextThe Matrix CookbookThe Matrix Cookbook EN
Справочник формул производных по матрицам. Там градиент записан в форме самой матрицы, то есть это $(Df)^t$ в соглашении лектораA reference of formulas for matrix derivatives. It writes the gradient in the shape of the matrix itself, which is $(Df)^t$ in the lecturer’s convention
текстtextWikipedia · Lagrange multiplierWikipedia · Lagrange multiplier EN
Картинки касания линии уровня и ограничения, пример с несколькими ограничениямиPictures of a level curve tangent to a constraint, and an example with several constraints
текстtextWikipedia · Principle of maximum entropyWikipedia · Principle of maximum entropy EN
Почему ограничение на среднее даёт экспоненциальное распределениеWhy a constraint on the mean gives an exponential distribution
как работать с задачамиhow to work with the problems
RU

Задачи урока выстроены в лестницу из четырёх ступеней; иди по порядку, каждая ступень опирается на предыдущую. Ответы вводятся числом, точка — разделитель (запятая тоже принимается). m0209 — доказательство: напиши его на бумаге, сравни с решением построчно и оцени себя честно.

Полный объём — 20 задач. Всё на странице. Рассчитано на два вечера: ступени 1–2 в первый, ступени 3–4 во второй.

Минимум — 12 задач. m0205, m0207, m0211, m0212, m0213, m0214, m0215, m0216, m0217, m0218, m0219, m0220 — все мосты, все финалы и две задачи ступени 2, без которых мосты не идут.

Обязательные — 6 задач. m0211 ведёт к финалу m0216 (производная по матрице), m0213 — к m0217 (вторая производная при замене переменных), m0214 — к m0218 (регрессия), m0215 — к m0219 и m0220 (Лагранж), а сами финалы m0216 и m0217 готовят к пунктам 1–3 домашнего задания. Если времени мало, делай эти шесть и мини-тест.

Мини-тест

m0219 решается за 20 минут без подсказок, ответ вводится один раз.

EN

The lesson’s problems form a ladder of four steps; go in order, since each ladder step builds on the previous one. Answers are entered as numbers with a decimal point (a comma is also accepted). m0209 is a proof: write it on paper, compare it with the solution line by line, and grade yourself honestly.

Full workload — 20 problems. Everything on the page. Plan for two evenings: ladder steps 1–2 on the first, ladder steps 3–4 on the second.

Minimum — 12 problems. m0205, m0207, m0211, m0212, m0213, m0214, m0215, m0216, m0217, m0218, m0219, m0220 — all bridges, all finals, and the two ladder step 2 problems the bridges cannot go without.

Required — 6 problems. m0211 leads to the final m0216 (derivative with respect to a matrix), m0213 to m0217 (second derivative under a change of variables), m0214 to m0218 (regression), m0215 to m0219 and m0220 (Lagrange), and the finals m0216 and m0217 themselves prepare for items 1–3 of the homework. If time is short, do these six and the mini-test.

Mini-test

m0219 is solved in 20 minutes without hints; the answer is entered once.

20
полный объёмfull workload
12
минимумminimum
6
обязательныеrequired

Полный объём — все задачи ниже. Минимум — если времени мало. Обязательные — мосты к финалам, их не пропускают.Full workload: every problem below. Minimum: when time is short. Required: the bridges to the finals; never skip them.

Ступень 1 · Базовая техникаStep 1 · Basic technique

решено 0 из 40 of 4 solved

Один ход и маленькие числа: проверка, что определение понято. 1–3 минуты на задачу.One move and small numbers: a check that the definition is understood. 1–3 minutes per problem.

m0201ступень 1step 1CM.10лекция, 1:41:08lecture, 1:41:08
RU

Пусть $f(x)=(x^1)^3+x^1x^2$, $x_0=(1,2)^t$, $u=(2,-1)^t$ и $g(t)=f(x_0+tu)$. Найдите $g'(0)$.

EN

Let $f(x)=(x^1)^3+x^1x^2$, $x_0=(1,2)^t$, $u=(2,-1)^t$, and $g(t)=f(x_0+tu)$. Find $g'(0)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 1Hint 1 of 1
RU

По цепному правилу $g'(0)=Df(x_0)\,u$: нужна строка частных производных $f$ в точке $x_0$, умноженная на столбец $u$ справа.

EN

By the chain rule $g'(0)=Df(x_0)\,u$: you need the row of partial derivatives of $f$ at $x_0$, multiplied by the column $u$ on the right.

РешениеSolution
RU

Матрица производной. $\dfrac{\partial f}{\partial x^1}=3(x^1)^2+x^2$, $\dfrac{\partial f}{\partial x^2}=x^1$. В точке $x_0=(1,2)^t$: $3\cdot1+2=5$ и $1$, поэтому $Df(x_0)=(5,\ 1)$ — строка $1\times2$.

Умножение на направление.

$$g'(0)=Df(x_0)\,u=(5,\ 1)\begin{pmatrix}2\\-1\end{pmatrix}=10-1=9.$$

Проверка подстановкой. $x_0+tu=(1+2t,\ 2-t)^t$, поэтому $g(t)=(1+2t)^3+(1+2t)(2-t)$ и

$$g'(t)=6(1+2t)^2+2(2-t)-(1+2t),\qquad g'(0)=6+4-1=9.$$

Вектор $u$ здесь не единичный: в определении лектора $g(t)=f(x_0+tu)$ этого не требуется, просто ответ пропорционален $u$.

EN

Derivative matrix. $\dfrac{\partial f}{\partial x^1}=3(x^1)^2+x^2$, $\dfrac{\partial f}{\partial x^2}=x^1$. At $x_0=(1,2)^t$: $3\cdot1+2=5$ and $1$, so $Df(x_0)=(5,\ 1)$ — a $1\times2$ row.

Multiplying by the direction.

$$g'(0)=Df(x_0)\,u=(5,\ 1)\begin{pmatrix}2\\-1\end{pmatrix}=10-1=9.$$

Check by substitution. $x_0+tu=(1+2t,\ 2-t)^t$, so $g(t)=(1+2t)^3+(1+2t)(2-t)$ and

$$g'(t)=6(1+2t)^2+2(2-t)-(1+2t),\qquad g'(0)=6+4-1=9.$$

The vector $u$ is not a unit vector here: the lecturer’s definition $g(t)=f(x_0+tu)$ does not require it; the answer is simply proportional to $u$.

m0202ступень 1step 1CM.9доска, фото 01board, photo 01
RU

Пусть $f(X)=\tr(X^tX)$ для $X\in M_{2\times2}$, $X_0=\begin{pmatrix}1&2\\0&1\end{pmatrix}$, $U=\begin{pmatrix}1&1\\3&1\end{pmatrix}$. Найдите $\lim_{h\to0}\dfrac{f(X_0+hU)-f(X_0)}{h}$.

EN

Let $f(X)=\tr(X^tX)$ for $X\in M_{2\times2}$, $X_0=\begin{pmatrix}1&2\\0&1\end{pmatrix}$, $U=\begin{pmatrix}1&1\\3&1\end{pmatrix}$. Find $\lim_{h\to0}\dfrac{f(X_0+hU)-f(X_0)}{h}$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

В уроке показано, что для этой функции $Df(X_0)=2X_0^t$, а предел равен $\tr(Df(X_0)\,U)$.

EN

The lesson shows that for this function $Df(X_0)=2X_0^t$, and the limit equals $\tr(Df(X_0)\,U)$.

Подсказка 2 из 2Hint 2 of 2
RU

$\tr(X_0^tU)$ — сумма произведений элементов $X_0$ и $U$, стоящих на одинаковых местах.

EN

$\tr(X_0^tU)$ is the sum of products of the entries of $X_0$ and $U$ in the same positions.

РешениеSolution
RU

Разложение по $h$. Раскрываем скобки и пользуемся $\tr(U^tX_0)=\tr(X_0^tU)$ (матрица и транспонированная имеют один след):

$$f(X_0+hU)-f(X_0)=2h\,\tr(X_0^tU)+h^2\tr(U^tU).$$

После деления на $h$ и предела $h\to0$ остаётся $2\tr(X_0^tU)$.

Счёт. $X_0^t=\begin{pmatrix}1&0\\2&1\end{pmatrix}$, и

$$X_0^tU=\begin{pmatrix}1\cdot1+0\cdot3&1\cdot1+0\cdot1\\2\cdot1+1\cdot3&2\cdot1+1\cdot1\end{pmatrix}=\begin{pmatrix}1&1\\5&3\end{pmatrix},\qquad \tr(X_0^tU)=1+3=4.$$

Предел равен $2\cdot4=8$.

Проверка поэлементно. $\tr(X_0^tU)=1\cdot1+2\cdot1+0\cdot3+1\cdot1=4$. И напрямую: $f(X)$ — сумма квадратов элементов, $X_0+hU=\begin{pmatrix}1+h&2+h\\3h&1+h\end{pmatrix}$, так что $f(X_0+hU)=(1+h)^2+(2+h)^2+9h^2+(1+h)^2=6+8h+12h^2$. Коэффициент при $h$ равен $8$.

EN

Expansion in $h$. Expand the brackets and use $\tr(U^tX_0)=\tr(X_0^tU)$ (a matrix and its transpose have the same trace):

$$f(X_0+hU)-f(X_0)=2h\,\tr(X_0^tU)+h^2\tr(U^tU).$$

After dividing by $h$ and letting $h\to0$, what remains is $2\tr(X_0^tU)$.

Computation. $X_0^t=\begin{pmatrix}1&0\\2&1\end{pmatrix}$, and

$$X_0^tU=\begin{pmatrix}1\cdot1+0\cdot3&1\cdot1+0\cdot1\\2\cdot1+1\cdot3&2\cdot1+1\cdot1\end{pmatrix}=\begin{pmatrix}1&1\\5&3\end{pmatrix},\qquad \tr(X_0^tU)=1+3=4.$$

The limit is $2\cdot4=8$.

Entrywise check. $\tr(X_0^tU)=1\cdot1+2\cdot1+0\cdot3+1\cdot1=4$. And directly: $f(X)$ is the sum of the squares of the entries, $X_0+hU=\begin{pmatrix}1+h&2+h\\3h&1+h\end{pmatrix}$, so $f(X_0+hU)=(1+h)^2+(2+h)^2+9h^2+(1+h)^2=6+8h+12h^2$. The coefficient of $h$ is $8$.

m0203ступень 1step 1CM.11доска, фото 06board, photo 06
RU

Пусть $f(x,y)=x^2+3xy$ и $F(r,\theta)=f(r\cos\theta,\ r\sin\theta)$. Найдите $\dfrac{\partial F}{\partial\theta}$ в точке $r=2$, $\theta=\frac{\pi}{4}$.

EN

Let $f(x,y)=x^2+3xy$ and $F(r,\theta)=f(r\cos\theta,\ r\sin\theta)$. Find $\dfrac{\partial F}{\partial\theta}$ at $r=2$, $\theta=\frac{\pi}{4}$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 1Hint 1 of 1
RU

Формула с доски: $\frac{\partial F}{\partial\theta}=\frac{\partial f}{\partial x}(-r\sin\theta)+\frac{\partial f}{\partial y}\,r\cos\theta$, где производные $f$ берутся в точке $x=r\cos\theta$, $y=r\sin\theta$.

EN

The formula from the board: $\frac{\partial F}{\partial\theta}=\frac{\partial f}{\partial x}(-r\sin\theta)+\frac{\partial f}{\partial y}\,r\cos\theta$, where the derivatives of $f$ are taken at $x=r\cos\theta$, $y=r\sin\theta$.

РешениеSolution
RU

Точка. $x=2\cdot\frac{\sqrt2}{2}=\sqrt2$, $y=\sqrt2$.

Частные производные $f$. $\frac{\partial f}{\partial x}=2x+3y=5\sqrt2$, $\frac{\partial f}{\partial y}=3x=3\sqrt2$.

Коэффициенты замены. $-r\sin\theta=-\sqrt2$, $r\cos\theta=\sqrt2$.

Цепное правило.

$$\frac{\partial F}{\partial\theta}=5\sqrt2\cdot(-\sqrt2)+3\sqrt2\cdot\sqrt2=-10+6=-4.$$

Проверка напрямую. $F=r^2\cos^2\theta+3r^2\cos\theta\sin\theta=r^2\big(\cos^2\theta+\tfrac32\sin2\theta\big)$, поэтому $\frac{\partial F}{\partial\theta}=r^2(-\sin2\theta+3\cos2\theta)$. При $r=2$, $\theta=\frac{\pi}{4}$: $4\cdot(-1+0)=-4$.

EN

The point. $x=2\cdot\frac{\sqrt2}{2}=\sqrt2$, $y=\sqrt2$.

Partial derivatives of $f$. $\frac{\partial f}{\partial x}=2x+3y=5\sqrt2$, $\frac{\partial f}{\partial y}=3x=3\sqrt2$.

Coefficients of the change. $-r\sin\theta=-\sqrt2$, $r\cos\theta=\sqrt2$.

Chain rule.

$$\frac{\partial F}{\partial\theta}=5\sqrt2\cdot(-\sqrt2)+3\sqrt2\cdot\sqrt2=-10+6=-4.$$

Direct check. $F=r^2\cos^2\theta+3r^2\cos\theta\sin\theta=r^2\big(\cos^2\theta+\tfrac32\sin2\theta\big)$, so $\frac{\partial F}{\partial\theta}=r^2(-\sin2\theta+3\cos2\theta)$. At $r=2$, $\theta=\frac{\pi}{4}$: $4\cdot(-1+0)=-4$.

m0204ступень 1step 1CM.15доска, фото 10board, photo 10
RU

Найдите наибольшее значение функции $f(x,y)=x+2y$ на окружности $x^2+y^2=5$.

EN

Find the largest value of the function $f(x,y)=x+2y$ on the circle $x^2+y^2=5$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Линии уровня $x+2y=c$ — параллельные прямые; в точке максимума такая прямая касается окружности. Аналитически это $\nabla f=\lambda\nabla g$ при $g=x^2+y^2-5$.

EN

The level curves $x+2y=c$ are parallel lines; at the maximum such a line is tangent to the circle. Analytically this is $\nabla f=\lambda\nabla g$ with $g=x^2+y^2-5$.

Подсказка 2 из 2Hint 2 of 2
RU

Из $(1,2)^t=\lambda(2x,2y)^t$ следует $y=2x$. Подставь это в ограничение.

EN

From $(1,2)^t=\lambda(2x,2y)^t$ it follows that $y=2x$. Substitute this into the constraint.

РешениеSolution
RU

Существование. Окружность — замкнутое ограниченное множество, $f$ непрерывна, поэтому наибольшее значение достигается.

Ранг. $\nabla g=(2x,2y)^t$ на окружности не равен нулю, ранг $1$.

Система Лагранжа. $1=2\lambda x$, $2=2\lambda y$. Отсюда $\lambda\ne0$, $x=\frac{1}{2\lambda}$, $y=\frac{1}{\lambda}=2x$. Ограничение: $x^2+4x^2=5$, $x=\pm1$. Кандидаты $(1,2)$ с $f=5$ и $(-1,-2)$ с $f=-5$. Наибольшее значение $5$.

Проверка. По неравенству Коши — Буняковского $x+2y=\langle(1,2)^t,(x,y)^t\rangle\le\sqrt5\cdot\sqrt5=5$, и равенство достигается при $(x,y)$, пропорциональном $(1,2)$. Геометрически: радиус в точку $(1,2)$ параллелен нормали $(1,2)^t$ прямой $x+2y=5$, то есть прямая касается окружности.

EN

Existence. The circle is a closed bounded set and $f$ is continuous, so the largest value is attained.

Rank. $\nabla g=(2x,2y)^t$ is nonzero on the circle; the rank is $1$.

Lagrange system. $1=2\lambda x$, $2=2\lambda y$. Hence $\lambda\ne0$, $x=\frac{1}{2\lambda}$, $y=\frac{1}{\lambda}=2x$. The constraint: $x^2+4x^2=5$, $x=\pm1$. The candidates are $(1,2)$ with $f=5$ and $(-1,-2)$ with $f=-5$. The largest value is $5$.

Check. By the Cauchy–Schwarz inequality $x+2y=\langle(1,2)^t,(x,y)^t\rangle\le\sqrt5\cdot\sqrt5=5$, and equality holds for $(x,y)$ proportional to $(1,2)$. Geometrically: the radius to the point $(1,2)$ is parallel to the normal $(1,2)^t$ of the line $x+2y=5$, so the line is tangent to the circle.

Ступень 2 · Техника с усложнениемStep 2 · Technique with one complication

решено 0 из 60 of 6 solved

Тот же ход и ровно одно усложнение: больше размер, знак или композиция.The same move plus exactly one complication: a larger size, a sign, or a composition.

m0205ступень 2step 2минимумminimumCM.7CM.10доска, фото 04board, photo 04
RU

Пусть $f(x,y)=xy^2+x$ и $\gamma(t)=(t^2,\ t^3)^t$. Найдите $\dfrac{d}{dt}f(\gamma(t))$ при $t=1$.

EN

Let $f(x,y)=xy^2+x$ and $\gamma(t)=(t^2,\ t^3)^t$. Find $\dfrac{d}{dt}f(\gamma(t))$ at $t=1$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Это основной случай цепного правила из доказательства лектора: $u^1=g_1(t)$, $u^2=g_2(t)$.

EN

This is the essential case of the chain rule from the lecturer’s proof: $u^1=g_1(t)$, $u^2=g_2(t)$.

Подсказка 2 из 2Hint 2 of 2
RU

$\frac{d}{dt}f(\gamma(t))=Df(\gamma(t))\,\gamma'(t)$. Найди точку $\gamma(1)$ и вектор $\gamma'(1)$.

EN

$\frac{d}{dt}f(\gamma(t))=Df(\gamma(t))\,\gamma'(t)$. Find the point $\gamma(1)$ and the vector $\gamma'(1)$.

РешениеSolution
RU

Точка и скорость. $\gamma(1)=(1,1)^t$, $\gamma'(t)=(2t,\ 3t^2)^t$, $\gamma'(1)=(2,3)^t$.

Матрица производной. $\frac{\partial f}{\partial x}=y^2+1=2$, $\frac{\partial f}{\partial y}=2xy=2$ в точке $(1,1)$, поэтому $Df(\gamma(1))=(2,\ 2)$.

Цепное правило.

$$\frac{d}{dt}f(\gamma(t))\Big|_{t=1}=(2,\ 2)\begin{pmatrix}2\\3\end{pmatrix}=4+6=10.$$

Проверка подстановкой. $f(\gamma(t))=t^2\cdot t^6+t^2=t^8+t^2$, производная $8t^7+2t$, при $t=1$ это $10$.

Отличие от m0201: внутренняя функция не линейна, её производная $\gamma'(t)$ зависит от $t$, и её тоже нужно взять в точке $t=1$.

EN

Point and velocity. $\gamma(1)=(1,1)^t$, $\gamma'(t)=(2t,\ 3t^2)^t$, $\gamma'(1)=(2,3)^t$.

Derivative matrix. $\frac{\partial f}{\partial x}=y^2+1=2$, $\frac{\partial f}{\partial y}=2xy=2$ at $(1,1)$, so $Df(\gamma(1))=(2,\ 2)$.

Chain rule.

$$\frac{d}{dt}f(\gamma(t))\Big|_{t=1}=(2,\ 2)\begin{pmatrix}2\\3\end{pmatrix}=4+6=10.$$

Check by substitution. $f(\gamma(t))=t^2\cdot t^6+t^2=t^8+t^2$, the derivative is $8t^7+2t$, and at $t=1$ it is $10$.

The difference from m0201: the inner function is not linear, its derivative $\gamma'(t)$ depends on $t$, and it must also be taken at $t=1$.

m0206ступень 2step 2CM.9авторскаяoriginal
RU

Пусть $f(X)=\tr(X^2)$ для $X\in M_{2\times2}$ и $X_0=\begin{pmatrix}1&2\\3&4\end{pmatrix}$. Найдите элемент в строке 1, столбце 2 матрицы $Z=Df(X_0)$ в соглашении лектора: $f(X_0+U)-f(X_0)=\tr(ZU)+o(\lVert U\rVert)$.

EN

Let $f(X)=\tr(X^2)$ for $X\in M_{2\times2}$ and $X_0=\begin{pmatrix}1&2\\3&4\end{pmatrix}$. Find the entry in row 1, column 2 of the matrix $Z=Df(X_0)$ in the lecturer’s convention: $f(X_0+U)-f(X_0)=\tr(ZU)+o(\lVert U\rVert)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Раскрой $(X_0+hU)^2$, не переставляя множители: $X_0U$ и $UX_0$ — разные матрицы.

EN

Expand $(X_0+hU)^2$ without reordering the factors: $X_0U$ and $UX_0$ are different matrices.

Подсказка 2 из 2Hint 2 of 2
RU

Часть, линейная по $h$, равна $h\,\tr(X_0U+UX_0)$. Сведи оба следа к виду $\tr(\,\cdot\,U)$ свойством $\tr(AB)=\tr(BA)$.

EN

The part linear in $h$ is $h\,\tr(X_0U+UX_0)$. Bring both traces to the form $\tr(\,\cdot\,U)$ with the property $\tr(AB)=\tr(BA)$.

РешениеSolution
RU

Разложение. $(X_0+hU)^2=X_0^2+h(X_0U+UX_0)+h^2U^2$, поэтому

$$f(X_0+hU)-f(X_0)=h\,\tr(X_0U+UX_0)+h^2\tr(U^2).$$

Приведение к виду $\tr(ZU)$. $\tr(UX_0)=\tr(X_0U)$, значит линейная часть равна $2h\,\tr(X_0U)=h\,\tr(2X_0U)$, и

$$Z=2X_0=\begin{pmatrix}2&4\\6&8\end{pmatrix}.$$

Элемент в строке 1, столбце 2 равен $4$.

Проверка частной производной. $\tr(ZU)=\sum_{i,j}z_{ji}u_{ij}$, поэтому при $u_{21}$ стоит $z_{12}$, и $z_{12}=\frac{\partial f}{\partial x_{21}}$. Для $2\times2$: $\tr(X^2)=x_{11}^2+2x_{12}x_{21}+x_{22}^2$, и $\frac{\partial f}{\partial x_{21}}=2x_{12}=4$.

Ловушка соглашения

Транспонированная матрица $2X_0^t$ дала бы в этом месте $6$. Порядок «$Z$ слева от $U$ под следом» — то, что отличает соглашение лектора от формы градиента в библиотеках.

EN

Expansion. $(X_0+hU)^2=X_0^2+h(X_0U+UX_0)+h^2U^2$, so

$$f(X_0+hU)-f(X_0)=h\,\tr(X_0U+UX_0)+h^2\tr(U^2).$$

Bringing it to the form $\tr(ZU)$. $\tr(UX_0)=\tr(X_0U)$, so the linear part equals $2h\,\tr(X_0U)=h\,\tr(2X_0U)$, and

$$Z=2X_0=\begin{pmatrix}2&4\\6&8\end{pmatrix}.$$

The entry in row 1, column 2 is $4$.

Check with a partial derivative. $\tr(ZU)=\sum_{i,j}z_{ji}u_{ij}$, so $u_{21}$ is multiplied by $z_{12}$, and $z_{12}=\frac{\partial f}{\partial x_{21}}$. For $2\times2$: $\tr(X^2)=x_{11}^2+2x_{12}x_{21}+x_{22}^2$, and $\frac{\partial f}{\partial x_{21}}=2x_{12}=4$.

The convention trap

The transposed matrix $2X_0^t$ would give $6$ in this position. The order “$Z$ to the left of $U$ under the trace” is what distinguishes the lecturer’s convention from the gradient shape used in libraries.

m0207ступень 2step 2минимумminimumCM.12доска, фото 05board, photo 05
RU

Пусть $f(x)=(x^1)^2x^2+(x^2)^3$, $a=(1,1)^t$, $b=(2,3)^t$ и $g(t)=f\big((1-t)a+tb\big)$. Найдите $g''(0)$.

EN

Let $f(x)=(x^1)^2x^2+(x^2)^3$, $a=(1,1)^t$, $b=(2,3)^t$, and $g(t)=f\big((1-t)a+tb\big)$. Find $g''(0)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

По формуле с доски $g''(t)$ — двойная сумма вторых частных производных, умноженных на $(b^j-a^j)(b^i-a^i)$. При $t=0$ точка равна $a$.

EN

By the formula from the board, $g''(t)$ is a double sum of second partial derivatives multiplied by $(b^j-a^j)(b^i-a^i)$. At $t=0$ the point is $a$.

Подсказка 2 из 2Hint 2 of 2
RU

Найди $b-a$ и матрицу вторых производных $H(a)$, затем посчитай $(b-a)^tH(a)(b-a)$.

EN

Find $b-a$ and the matrix of second derivatives $H(a)$, then compute $(b-a)^tH(a)(b-a)$.

РешениеSolution
RU

Направление. $b-a=(1,2)^t$.

Вторые производные. $\frac{\partial^2f}{\partial(x^1)^2}=2x^2$, $\frac{\partial^2f}{\partial x^1\partial x^2}=2x^1$, $\frac{\partial^2f}{\partial(x^2)^2}=6x^2$. В точке $a=(1,1)^t$ это $2$, $2$, $6$: $H(a)=\begin{pmatrix}2&2\\2&6\end{pmatrix}$.

Двойная сумма.

$$g''(0)=2\cdot1\cdot1+2\cdot1\cdot2+2\cdot2\cdot1+6\cdot2\cdot2=2+4+4+24=34.$$

Проверка подстановкой. $(1-t)a+tb=(1+t,\ 1+2t)^t$, $g(t)=(1+t)^2(1+2t)+(1+2t)^3$. Первое слагаемое: производная $2(1+t)(1+2t)+2(1+t)^2$, вторая производная $2(1+2t)+4(1+t)+4(1+t)$, при $t=0$ это $10$. Второе слагаемое: производная $6(1+2t)^2$, вторая $24(1+2t)$, при $t=0$ это $24$. Сумма $34$.

EN

Direction. $b-a=(1,2)^t$.

Second derivatives. $\frac{\partial^2f}{\partial(x^1)^2}=2x^2$, $\frac{\partial^2f}{\partial x^1\partial x^2}=2x^1$, $\frac{\partial^2f}{\partial(x^2)^2}=6x^2$. At $a=(1,1)^t$ these are $2$, $2$, $6$: $H(a)=\begin{pmatrix}2&2\\2&6\end{pmatrix}$.

Double sum.

$$g''(0)=2\cdot1\cdot1+2\cdot1\cdot2+2\cdot2\cdot1+6\cdot2\cdot2=2+4+4+24=34.$$

Check by substitution. $(1-t)a+tb=(1+t,\ 1+2t)^t$, $g(t)=(1+t)^2(1+2t)+(1+2t)^3$. First term: the derivative is $2(1+t)(1+2t)+2(1+t)^2$, the second derivative is $2(1+2t)+4(1+t)+4(1+t)$, at $t=0$ this is $10$. Second term: the derivative is $6(1+2t)^2$, the second derivative $24(1+2t)$, at $t=0$ this is $24$. The sum is $34$.

m0208ступень 2step 2CM.11по мотивам ДЗ HW-M02, п. 2based on homework HW-M02, item 2
RU

Функция $f(x,y)$ дифференцируема, $F(u,v)=f(u+v^2,\ uv)$. Известно, что в точке $(u,v)=(1,1)$ выполнено $\dfrac{\partial F}{\partial u}=5$ и $\dfrac{\partial F}{\partial v}=4$. Найдите $\dfrac{\partial f}{\partial x}$ в соответствующей точке $(x,y)=(2,1)$.

EN

The function $f(x,y)$ is differentiable, $F(u,v)=f(u+v^2,\ uv)$. It is known that at the point $(u,v)=(1,1)$ we have $\dfrac{\partial F}{\partial u}=5$ and $\dfrac{\partial F}{\partial v}=4$. Find $\dfrac{\partial f}{\partial x}$ at the corresponding point $(x,y)=(2,1)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Выпиши цепное правило для $\partial F/\partial u$ и $\partial F/\partial v$: неизвестными будут $\partial f/\partial x$ и $\partial f/\partial y$.

EN

Write the chain rule for $\partial F/\partial u$ and $\partial F/\partial v$: the unknowns are $\partial f/\partial x$ and $\partial f/\partial y$.

Подсказка 2 из 2Hint 2 of 2
RU

При $u=v=1$: $\frac{\partial x}{\partial u}=1$, $\frac{\partial x}{\partial v}=2v=2$, $\frac{\partial y}{\partial u}=v=1$, $\frac{\partial y}{\partial v}=u=1$. Получится система $2\times2$.

EN

At $u=v=1$: $\frac{\partial x}{\partial u}=1$, $\frac{\partial x}{\partial v}=2v=2$, $\frac{\partial y}{\partial u}=v=1$, $\frac{\partial y}{\partial v}=u=1$. This gives a $2\times2$ system.

РешениеSolution
RU

Цепное правило. Обозначим $f_x=\frac{\partial f}{\partial x}$, $f_y=\frac{\partial f}{\partial y}$ в точке $(2,1)$:

$$\frac{\partial F}{\partial u}=f_x\cdot1+f_y\cdot v,\qquad \frac{\partial F}{\partial v}=f_x\cdot2v+f_y\cdot u.$$

Система при $u=v=1$.

$$f_x+f_y=5,\qquad 2f_x+f_y=4.$$

Вычитаем первое уравнение из второго: $f_x=4-5=-1$. Тогда $f_y=5-(-1)=6$.

Матричная форма. $\big(\frac{\partial F}{\partial u},\frac{\partial F}{\partial v}\big)=(f_x,f_y)\begin{pmatrix}1&2\\1&1\end{pmatrix}$; определитель матрицы замены $1-2=-1\ne0$, поэтому решение единственно.

Проверка. Подставляем $f_x=-1$, $f_y=6$: $-1+6=5$ и $-2+6=4$. Пример функции с такими производными: $f=-x+6y$, тогда $F=-(u+v^2)+6uv$, $\frac{\partial F}{\partial u}=-1+6v=5$, $\frac{\partial F}{\partial v}=-2v+6u=4$ при $u=v=1$.

EN

Chain rule. Write $f_x=\frac{\partial f}{\partial x}$, $f_y=\frac{\partial f}{\partial y}$ at the point $(2,1)$:

$$\frac{\partial F}{\partial u}=f_x\cdot1+f_y\cdot v,\qquad \frac{\partial F}{\partial v}=f_x\cdot2v+f_y\cdot u.$$

The system at $u=v=1$.

$$f_x+f_y=5,\qquad 2f_x+f_y=4.$$

Subtract the first equation from the second: $f_x=4-5=-1$. Then $f_y=5-(-1)=6$.

Matrix form. $\big(\frac{\partial F}{\partial u},\frac{\partial F}{\partial v}\big)=(f_x,f_y)\begin{pmatrix}1&2\\1&1\end{pmatrix}$; the determinant of the change matrix is $1-2=-1\ne0$, so the solution is unique.

Check. Substitute $f_x=-1$, $f_y=6$: $-1+6=5$ and $-2+6=4$. An example of a function with these derivatives: $f=-x+6y$; then $F=-(u+v^2)+6uv$, $\frac{\partial F}{\partial u}=-1+6v=5$, $\frac{\partial F}{\partial v}=-2v+6u=4$ at $u=v=1$.

m0209ступень 2step 2CM.13лекция, 2:21:21lecture, 2:21:21
RU

Пусть $f:D\to\R$, $D\subseteq\R^N$, принимает наименьшее значение на $D$ в точке $x_0$, точка $x_0$ — внутренняя точка $D$, и производная $Df(x_0)$ существует. Докажите, что $Df(x_0)=0$, пользуясь только теоремой Ферма для функций одной переменной и цепным правилом.

EN

Let $f:D\to\R$, $D\subseteq\R^N$, attain its smallest value on $D$ at a point $x_0$, let $x_0$ be an interior point of $D$, and let the derivative $Df(x_0)$ exist. Prove that $Df(x_0)=0$, using only Fermat’s theorem for functions of one variable and the chain rule.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Зафиксируй направление $u\ne0$ и рассмотри $g(t)=f(x_0+tu)$. На каком множестве значений $t$ она определена?

EN

Fix a direction $u\ne0$ and consider $g(t)=f(x_0+tu)$. For which values of $t$ is it defined?

Подсказка 2 из 2Hint 2 of 2
RU

Внутренность даёт шар $B(x_0,\varepsilon)\subseteq D$. При $\lvert t\rvert<\varepsilon/\lVert u\rVert$ точка $x_0+tu$ лежит в шаре. Какая точка этого интервала — минимум $g$?

EN

Interiority gives a ball $B(x_0,\varepsilon)\subseteq D$. For $\lvert t\rvert<\varepsilon/\lVert u\rVert$ the point $x_0+tu$ lies in the ball. Which point of this interval is a minimum of $g$?

РешениеSolution
RU

Шаг 1. Функция одной переменной. Так как $x_0$ — внутренняя точка, есть $\varepsilon>0$ с $B(x_0,\varepsilon)\subseteq D$. Зафиксируем $u\ne0$ и положим $\delta=\varepsilon/\lVert u\rVert$. При $\lvert t\rvert<\delta$ выполнено $\lVert(x_0+tu)-x_0\rVert=\lvert t\rvert\,\lVert u\rVert<\varepsilon$, поэтому $x_0+tu\in D$, и функция $g(t)=f(x_0+tu)$ определена на интервале $(-\delta,\delta)$.

Шаг 2. Минимум во внутренней точке интервала. Для всех $t\in(-\delta,\delta)$ имеем $g(t)=f(x_0+tu)\ge f(x_0)=g(0)$, так как $f(x_0)$ — наименьшее значение $f$ на $D$. Значит, $g$ принимает наименьшее значение в точке $t=0$, и $0$ — внутренняя точка интервала $(-\delta,\delta)$.

Шаг 3. Производная $g$. Внутренняя функция $t\mapsto x_0+tu$ дифференцируема, её производная — $u$, а $Df(x_0)$ существует по условию. По цепному правилу $g'(0)$ существует и $g'(0)=Df(x_0)\,u$.

Шаг 4. Ферма для одной переменной. Функция $g$ дифференцируема в $0$ и имеет там минимум во внутренней точке, поэтому $g'(0)=0$, то есть $Df(x_0)\,u=0$ для каждого $u\ne0$.

Шаг 5. Все частные производные. Возьмём $u=e_j$ ($j$-й столбец единичной матрицы). Тогда $Df(x_0)\,e_j=\frac{\partial f}{\partial x^j}(x_0)=0$ для каждого $j=1,\dots,N$, и вся строка $Df(x_0)$ нулевая. $\blacksquare$

Где использована внутренность. В шагах 1–2: на границе допустимые $t$ могут образовать только полуинтервал $[0,\delta)$, точка $t=0$ становится концом, и теорема Ферма одной переменной не применима. Пример лектора: $f(x)=2x$ на $[0,1]$, минимум в $0$, а $f'(0)=2$. Для наибольшего значения то же рассуждение применяется к $-f$.

EN

Step 1. A function of one variable. Since $x_0$ is an interior point, there is $\varepsilon>0$ with $B(x_0,\varepsilon)\subseteq D$. Fix $u\ne0$ and set $\delta=\varepsilon/\lVert u\rVert$. For $\lvert t\rvert<\delta$ we have $\lVert(x_0+tu)-x_0\rVert=\lvert t\rvert\,\lVert u\rVert<\varepsilon$, so $x_0+tu\in D$, and the function $g(t)=f(x_0+tu)$ is defined on the interval $(-\delta,\delta)$.

Step 2. A minimum at an interior point of the interval. For all $t\in(-\delta,\delta)$ we have $g(t)=f(x_0+tu)\ge f(x_0)=g(0)$, because $f(x_0)$ is the smallest value of $f$ on $D$. So $g$ attains its smallest value at $t=0$, and $0$ is an interior point of the interval $(-\delta,\delta)$.

Step 3. The derivative of $g$. The inner function $t\mapsto x_0+tu$ is differentiable with derivative $u$, and $Df(x_0)$ exists by assumption. By the chain rule $g'(0)$ exists and $g'(0)=Df(x_0)\,u$.

Step 4. Fermat in one variable. The function $g$ is differentiable at $0$ and has a minimum there at an interior point, so $g'(0)=0$, that is, $Df(x_0)\,u=0$ for every $u\ne0$.

Step 5. All partial derivatives. Take $u=e_j$ (the $j$-th column of the identity matrix). Then $Df(x_0)\,e_j=\frac{\partial f}{\partial x^j}(x_0)=0$ for every $j=1,\dots,N$, and the whole row $Df(x_0)$ is zero. $\blacksquare$

Where interiority was used. In steps 1–2: at the boundary the admissible $t$ may form only a half-open interval $[0,\delta)$, the point $t=0$ becomes an endpoint, and Fermat’s theorem in one variable does not apply. The lecturer’s example: $f(x)=2x$ on $[0,1]$, the minimum is at $0$, but $f'(0)=2$. For the largest value, apply the same argument to $-f$.

Сравни своё доказательство с решением строка за строкой и отметь результат честно.Compare your proof with the solution line by line and mark the result honestly.

m0210ступень 2step 2CM.13лекция, 2:30:09lecture, 2:30:09
RU

Найдите наибольшее значение функции $f(x)=x^3-3x$ на отрезке $[0,3]$.

EN

Find the largest value of the function $f(x)=x^3-3x$ on the segment $[0,3]$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Кандидаты двух видов: внутренние точки, где $f'(x)=0$, и концы отрезка — про них теорема Ферма ничего не говорит.

EN

There are two kinds of candidates: interior points where $f'(x)=0$, and the endpoints — Fermat’s theorem says nothing about them.

Подсказка 2 из 2Hint 2 of 2
RU

$f'(x)=3x^2-3$ обращается в ноль внутри отрезка только при $x=1$. Сравни значения $f$ в трёх кандидатах.

EN

$f'(x)=3x^2-3$ vanishes inside the segment only at $x=1$. Compare the values of $f$ at the three candidates.

РешениеSolution
RU

Существование. $f$ непрерывна на замкнутом отрезке, поэтому наибольшее и наименьшее значения достигаются.

Внутренние кандидаты. $f'(x)=3x^2-3=0$ при $x=\pm1$; внутри $(0,3)$ лежит только $x=1$, $f(1)=1-3=-2$.

Концы. $f(0)=0$, $f(3)=27-9=18$.

Сравнение. Наибольшее значение $18$ — в точке $x=3$, наименьшее $-2$ — в точке $x=1$.

Почему это не противоречит Ферма. $f'(3)=27-3=24\ne0$, но $x=3$ — граница отрезка, а не внутренняя точка. Проверка: на $(1,3)$ производная $3x^2-3>0$, функция возрастает, поэтому наибольшее значение на правом конце.

EN

Existence. $f$ is continuous on a closed segment, so the largest and smallest values are attained.

Interior candidates. $f'(x)=3x^2-3=0$ at $x=\pm1$; only $x=1$ lies inside $(0,3)$, $f(1)=1-3=-2$.

Endpoints. $f(0)=0$, $f(3)=27-9=18$.

Comparison. The largest value is $18$ — at $x=3$; the smallest is $-2$ — at $x=1$.

Why this does not contradict Fermat. $f'(3)=27-3=24\ne0$, but $x=3$ is the boundary of the segment, not an interior point. Check: on $(1,3)$ the derivative $3x^2-3>0$, the function increases, so the largest value is at the right endpoint.

Ступень 3 · Мост к финалуStep 3 · Bridge to the final

решено 0 из 50 of 5 solved

Два хода вместе, как в финале. Здесь работает схема эталонной задачи.Two moves combined the way the final combines them. The model problem’s scheme works here.

m0211ступень 3step 3обязательнаяrequiredCM.9авторскаяoriginal
RU

Пусть $A=\begin{pmatrix}1&1\\0&2\end{pmatrix}$, $f(X)=\tr(X^tAX)$ для $X\in M_{2\times2}$ и $X_0=\begin{pmatrix}1&0\\2&1\end{pmatrix}$. Найдите элемент в строке 1, столбце 2 матрицы $Z=Df(X_0)$ в соглашении лектора: $f(X_0+U)-f(X_0)=\tr(ZU)+o(\lVert U\rVert)$.

EN

Let $A=\begin{pmatrix}1&1\\0&2\end{pmatrix}$, $f(X)=\tr(X^tAX)$ for $X\in M_{2\times2}$, and $X_0=\begin{pmatrix}1&0\\2&1\end{pmatrix}$. Find the entry in row 1, column 2 of the matrix $Z=Df(X_0)$ in the lecturer’s convention: $f(X_0+U)-f(X_0)=\tr(ZU)+o(\lVert U\rVert)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 3Hint 1 of 3
RU

Раскрой $(X_0+hU)^tA(X_0+hU)$ и оставь слагаемые первой степени по $h$: их два.

EN

Expand $(X_0+hU)^tA(X_0+hU)$ and keep the terms of first degree in $h$: there are two.

Подсказка 2 из 3Hint 2 of 3
RU

Одно слагаемое уже имеет вид $\tr(X_0^tAU)$. Второе, $\tr(U^tAX_0)$, транспонируй под следом.

EN

One term already has the form $\tr(X_0^tAU)$. Transpose the other, $\tr(U^tAX_0)$, under the trace.

Подсказка 3 из 3Hint 3 of 3
RU

Получится $Z=X_0^t(A+A^t)$. Осталось перемножить две матрицы $2\times2$.

EN

You get $Z=X_0^t(A+A^t)$. It remains to multiply two $2\times2$ matrices.

РешениеSolution
RU

Разложение.

$$(X_0+hU)^tA(X_0+hU)=X_0^tAX_0+h\big(U^tAX_0+X_0^tAU\big)+h^2U^tAU.$$

Берём след и вычитаем $f(X_0)$: линейная по $h$ часть равна $h\big(\tr(U^tAX_0)+\tr(X_0^tAU)\big)$.

Приведение к виду $\tr(ZU)$. След не меняется при транспонировании: $\tr(U^tAX_0)=\tr\big((U^tAX_0)^t\big)=\tr(X_0^tA^tU)$. Сумма двух следов равна $\tr\big(X_0^t(A+A^t)U\big)$, и

$$Z=X_0^t(A+A^t).$$

Размер: $(2\times2)(2\times2)=2\times2$, как и должно быть для $X\in M_{2\times2}$.

Счёт. $A+A^t=\begin{pmatrix}2&1\\1&4\end{pmatrix}$, $X_0^t=\begin{pmatrix}1&2\\0&1\end{pmatrix}$,

$$Z=\begin{pmatrix}1\cdot2+2\cdot1&1\cdot1+2\cdot4\\0\cdot2+1\cdot1&0\cdot1+1\cdot4\end{pmatrix}=\begin{pmatrix}4&9\\1&4\end{pmatrix}.$$

Элемент в строке 1, столбце 2 равен $9$.

Проверка частной производной. При $u_{21}$ в $\tr(ZU)$ стоит $z_{12}$, поэтому $z_{12}=\frac{\partial f}{\partial x_{21}}$. $\tr(X^tAX)$ — сумма $c^tAc$ по столбцам $c$ матрицы $X$; первый столбец $c=(x_{11},x_{21})^t$ даёт $c^tAc=x_{11}^2+x_{11}x_{21}+2x_{21}^2$, второй столбец от $x_{21}$ не зависит. Производная по $x_{21}$: $x_{11}+4x_{21}=1+8=9$.

Куда это ведёт

В финале m0216 переменная $X$ входит в произведение дважды без транспонирования, и следы приходится переставлять по циклу, а не транспонировать.

EN

Expansion.

$$(X_0+hU)^tA(X_0+hU)=X_0^tAX_0+h\big(U^tAX_0+X_0^tAU\big)+h^2U^tAU.$$

Take the trace and subtract $f(X_0)$: the part linear in $h$ is $h\big(\tr(U^tAX_0)+\tr(X_0^tAU)\big)$.

Bringing it to the form $\tr(ZU)$. The trace does not change under transposition: $\tr(U^tAX_0)=\tr\big((U^tAX_0)^t\big)=\tr(X_0^tA^tU)$. The sum of the two traces is $\tr\big(X_0^t(A+A^t)U\big)$, and

$$Z=X_0^t(A+A^t).$$

Size: $(2\times2)(2\times2)=2\times2$, as it must be for $X\in M_{2\times2}$.

Computation. $A+A^t=\begin{pmatrix}2&1\\1&4\end{pmatrix}$, $X_0^t=\begin{pmatrix}1&2\\0&1\end{pmatrix}$,

$$Z=\begin{pmatrix}1\cdot2+2\cdot1&1\cdot1+2\cdot4\\0\cdot2+1\cdot1&0\cdot1+1\cdot4\end{pmatrix}=\begin{pmatrix}4&9\\1&4\end{pmatrix}.$$

The entry in row 1, column 2 is $9$.

Check with a partial derivative. In $\tr(ZU)$ the entry $u_{21}$ is multiplied by $z_{12}$, so $z_{12}=\frac{\partial f}{\partial x_{21}}$. $\tr(X^tAX)$ is the sum of $c^tAc$ over the columns $c$ of $X$; the first column $c=(x_{11},x_{21})^t$ gives $c^tAc=x_{11}^2+x_{11}x_{21}+2x_{21}^2$, and the second column does not depend on $x_{21}$. The derivative in $x_{21}$: $x_{11}+4x_{21}=1+8=9$.

Where this leads

In the final m0216 the variable $X$ enters the product twice without a transpose, and the traces have to be permuted cyclically rather than transposed.

m0212ступень 3step 3минимумminimumCM.12доска, фото 05board, photo 05
RU

Пусть $f(x)=e^{x^1}\cos x^2$, $a=(0,0)^t$, $b=(0.1,\ 0.2)^t$ и $g(t)=f\big((1-t)a+tb\big)$. Найдите приближение второго порядка $f(a)+g'(0)+\frac12g''(0)$ к значению $f(b)$. Ответ дайте точно.

EN

Let $f(x)=e^{x^1}\cos x^2$, $a=(0,0)^t$, $b=(0.1,\ 0.2)^t$, and $g(t)=f\big((1-t)a+tb\big)$. Find the second-order approximation $f(a)+g'(0)+\frac12g''(0)$ to the value $f(b)$. Give the exact answer.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

$g'(0)=Df(a)(b-a)$ и $g''(0)=(b-a)^tH(a)(b-a)$.

EN

$g'(0)=Df(a)(b-a)$ and $g''(0)=(b-a)^tH(a)(b-a)$.

Подсказка 2 из 2Hint 2 of 2
RU

В точке $a$: $Df(a)=(1,\ 0)$ и $H(a)=\begin{pmatrix}1&0\\0&-1\end{pmatrix}$.

EN

At the point $a$: $Df(a)=(1,\ 0)$ and $H(a)=\begin{pmatrix}1&0\\0&-1\end{pmatrix}$.

РешениеSolution
RU

Производные в точке $a$. $f(a)=e^0\cos0=1$. $\frac{\partial f}{\partial x^1}=e^{x^1}\cos x^2=1$, $\frac{\partial f}{\partial x^2}=-e^{x^1}\sin x^2=0$; $\frac{\partial^2f}{\partial(x^1)^2}=e^{x^1}\cos x^2=1$, $\frac{\partial^2f}{\partial x^1\partial x^2}=-e^{x^1}\sin x^2=0$, $\frac{\partial^2f}{\partial(x^2)^2}=-e^{x^1}\cos x^2=-1$.

Первый и второй порядок. $b-a=(0.1,\ 0.2)^t$.

$$g'(0)=1\cdot0.1+0\cdot0.2=0.1,\qquad g''(0)=1\cdot0.1^2+2\cdot0\cdot0.1\cdot0.2+(-1)\cdot0.2^2=0.01-0.04=-0.03.$$

Приближение.

$$f(a)+g'(0)+\tfrac12g''(0)=1+0.1-0.015=1.085.$$

Проверка другим путём. Перемножим разложения одной переменной: $e^{0.1}\approx1+0.1+0.005$, $\cos0.2\approx1-0.02$; произведение до второго порядка $1+0.1+0.005-0.02=1.085$. Истинное значение $f(b)=e^{0.1}\cos0.2\approx1.0831$: разница около $0.002$ — величина третьего порядка по $\lVert b-a\rVert$.

EN

Derivatives at $a$. $f(a)=e^0\cos0=1$. $\frac{\partial f}{\partial x^1}=e^{x^1}\cos x^2=1$, $\frac{\partial f}{\partial x^2}=-e^{x^1}\sin x^2=0$; $\frac{\partial^2f}{\partial(x^1)^2}=e^{x^1}\cos x^2=1$, $\frac{\partial^2f}{\partial x^1\partial x^2}=-e^{x^1}\sin x^2=0$, $\frac{\partial^2f}{\partial(x^2)^2}=-e^{x^1}\cos x^2=-1$.

First and second order. $b-a=(0.1,\ 0.2)^t$.

$$g'(0)=1\cdot0.1+0\cdot0.2=0.1,\qquad g''(0)=1\cdot0.1^2+2\cdot0\cdot0.1\cdot0.2+(-1)\cdot0.2^2=0.01-0.04=-0.03.$$

Approximation.

$$f(a)+g'(0)+\tfrac12g''(0)=1+0.1-0.015=1.085.$$

Check by another route. Multiply the one-variable expansions: $e^{0.1}\approx1+0.1+0.005$, $\cos0.2\approx1-0.02$; the product up to second order is $1+0.1+0.005-0.02=1.085$. The true value $f(b)=e^{0.1}\cos0.2\approx1.0831$: the difference is about $0.002$ — a third-order quantity in $\lVert b-a\rVert$.

m0213ступень 3step 3обязательнаяrequiredCM.11по мотивам ДЗ HW-M02, п. 2based on homework HW-M02, item 2
RU

Функция $f(x,y)$ дважды непрерывно дифференцируема, $F(s,t)=f(st,\ s+t)$. В точке $(x,y)=(2,3)$ известно: $f_x=5$, $f_y=-2$, $f_{xx}=1$, $f_{xy}=-1$, $f_{yy}=3$ (обозначения: $f_x=\frac{\partial f}{\partial x}$, $f_{xy}=\frac{\partial^2 f}{\partial x\partial y}$). Найдите $\dfrac{\partial^2F}{\partial s^2}$ в точке $(s,t)=(1,2)$.

EN

The function $f(x,y)$ is twice continuously differentiable, $F(s,t)=f(st,\ s+t)$. At the point $(x,y)=(2,3)$ it is known that $f_x=5$, $f_y=-2$, $f_{xx}=1$, $f_{xy}=-1$, $f_{yy}=3$ (notation: $f_x=\frac{\partial f}{\partial x}$, $f_{xy}=\frac{\partial^2 f}{\partial x\partial y}$). Find $\dfrac{\partial^2F}{\partial s^2}$ at the point $(s,t)=(1,2)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Сначала $\frac{\partial F}{\partial s}=f_x\cdot t+f_y\cdot1$, где $f_x$ и $f_y$ берутся в точке $(st,\ s+t)$.

EN

First, $\frac{\partial F}{\partial s}=f_x\cdot t+f_y\cdot1$, where $f_x$ and $f_y$ are taken at the point $(st,\ s+t)$.

Подсказка 2 из 2Hint 2 of 2
RU

Продифференцируй ещё раз по $s$. $f_x(st,s+t)$ — сложная функция, её производная по $s$ равна $f_{xx}\,t+f_{xy}\cdot1$. Множитель $t$ от $s$ не зависит.

EN

Differentiate once more in $s$. $f_x(st,s+t)$ is a composite function; its derivative in $s$ is $f_{xx}\,t+f_{xy}\cdot1$. The factor $t$ does not depend on $s$.

РешениеSolution
RU

Первая производная. $x=st$, $y=s+t$, $\frac{\partial x}{\partial s}=t$, $\frac{\partial y}{\partial s}=1$:

$$\frac{\partial F}{\partial s}=f_x\cdot t+f_y.$$

Вторая производная. Дифференцируем каждое слагаемое по $s$, применяя цепное правило к $f_x$ и $f_y$:

$$\frac{\partial^2F}{\partial s^2}=\big(f_{xx}\,t+f_{xy}\big)\,t+\big(f_{yx}\,t+f_{yy}\big)=t^2f_{xx}+2t\,f_{xy}+f_{yy},$$

где использовано $f_{yx}=f_{xy}$ (вторые производные непрерывны).

Подстановка $t=2$. $4\cdot1+4\cdot(-1)+3=3$.

Почему не вошли $f_x$ и $f_y$. Коэффициенты замены $t$ и $1$ от $s$ не зависят: $\frac{\partial^2x}{\partial s^2}=0$, $\frac{\partial^2y}{\partial s^2}=0$. В финале m0217 это уже не так.

Проверка на конкретной функции. Многочлен $f=5(x-2)-2(y-3)+\frac12(x-2)^2-(x-2)(y-3)+\frac32(y-3)^2$ имеет в точке $(2,3)$ ровно эти производные. При $t=2$: $x-2=2(s-1)$, $y-3=s-1$, и $F=10(s-1)-2(s-1)+2(s-1)^2-2(s-1)^2+\frac32(s-1)^2=8(s-1)+\frac32(s-1)^2$. Вторая производная по $s$ равна $3$.

EN

First derivative. $x=st$, $y=s+t$, $\frac{\partial x}{\partial s}=t$, $\frac{\partial y}{\partial s}=1$:

$$\frac{\partial F}{\partial s}=f_x\cdot t+f_y.$$

Second derivative. Differentiate each term in $s$, applying the chain rule to $f_x$ and $f_y$:

$$\frac{\partial^2F}{\partial s^2}=\big(f_{xx}\,t+f_{xy}\big)\,t+\big(f_{yx}\,t+f_{yy}\big)=t^2f_{xx}+2t\,f_{xy}+f_{yy},$$

where we used $f_{yx}=f_{xy}$ (the second derivatives are continuous).

Substituting $t=2$. $4\cdot1+4\cdot(-1)+3=3$.

Why $f_x$ and $f_y$ did not enter. The coefficients of the change, $t$ and $1$, do not depend on $s$: $\frac{\partial^2x}{\partial s^2}=0$, $\frac{\partial^2y}{\partial s^2}=0$. In the final m0217 this is no longer so.

Check on a concrete function. The polynomial $f=5(x-2)-2(y-3)+\frac12(x-2)^2-(x-2)(y-3)+\frac32(y-3)^2$ has exactly these derivatives at $(2,3)$. At $t=2$: $x-2=2(s-1)$, $y-3=s-1$, and $F=10(s-1)-2(s-1)+2(s-1)^2-2(s-1)^2+\frac32(s-1)^2=8(s-1)+\frac32(s-1)^2$. The second derivative in $s$ is $3$.

m0214ступень 3step 3обязательнаяrequiredCM.13CM.14доска, фото 09board, photo 09
RU

Пусть $A=\begin{pmatrix}1&0\\1&1\\1&2\end{pmatrix}$ и $b=(2,1,3)^t$. Найдите наименьшее значение функции $f(x)=\lVert b-Ax\rVert^2$ по $x\in\R^2$. Ответ дайте точно.

EN

Let $A=\begin{pmatrix}1&0\\1&1\\1&2\end{pmatrix}$ and $b=(2,1,3)^t$. Find the smallest value of the function $f(x)=\lVert b-Ax\rVert^2$ over $x\in\R^2$. Give the exact answer.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Область — всё $\R^2$, поэтому минимум достигается во внутренней точке, где $Df(x)=0$, то есть $A^tAx=A^tb$.

EN

The domain is all of $\R^2$, so the minimum is attained at an interior point where $Df(x)=0$, that is, $A^tAx=A^tb$.

Подсказка 2 из 2Hint 2 of 2
RU

$A^tA=\begin{pmatrix}3&3\\3&5\end{pmatrix}$, $A^tb=(6,\ 7)^t$. Реши систему, затем посчитай невязку $b-Ax$.

EN

$A^tA=\begin{pmatrix}3&3\\3&5\end{pmatrix}$, $A^tb=(6,\ 7)^t$. Solve the system, then compute the residual $b-Ax$.

РешениеSolution
RU

Нормальные уравнения. Столбцы $A$: $c_1=(1,1,1)^t$, $c_2=(0,1,2)^t$. Тогда $c_1^tc_1=3$, $c_1^tc_2=3$, $c_2^tc_2=5$, $c_1^tb=2+1+3=6$, $c_2^tb=0+1+6=7$:

$$\begin{pmatrix}3&3\\3&5\end{pmatrix}x=\begin{pmatrix}6\\7\end{pmatrix}.$$

Вычитаем первое уравнение из второго: $2x^2=1$, $x^2=0.5$; из первого $x^1=2-0.5=1.5$.

Значение. $Ax=(1.5,\ 2,\ 2.5)^t$, невязка $r=b-Ax=(0.5,\ -1,\ 0.5)^t$, и

$$f=0.25+1+0.25=1.5.$$

Проверка ортогональности. $c_1^tr=0.5-1+0.5=0$, $c_2^tr=0-1+1=0$: невязка ортогональна столбцам, это и есть $A^t(b-Ax)=0$.

Почему это минимум, а не просто кандидат. Для любого $x$: $b-Ax=r+A(x_*-x)$, где $x_*=(1.5,\ 0.5)^t$. Так как $r^tA=0$, перекрёстное слагаемое пропадает: $\lVert b-Ax\rVert^2=\lVert r\rVert^2+\lVert A(x_*-x)\rVert^2\ge\lVert r\rVert^2=1.5$.

EN

Normal equations. The columns of $A$: $c_1=(1,1,1)^t$, $c_2=(0,1,2)^t$. Then $c_1^tc_1=3$, $c_1^tc_2=3$, $c_2^tc_2=5$, $c_1^tb=2+1+3=6$, $c_2^tb=0+1+6=7$:

$$\begin{pmatrix}3&3\\3&5\end{pmatrix}x=\begin{pmatrix}6\\7\end{pmatrix}.$$

Subtract the first equation from the second: $2x^2=1$, $x^2=0.5$; from the first, $x^1=2-0.5=1.5$.

Value. $Ax=(1.5,\ 2,\ 2.5)^t$, the residual is $r=b-Ax=(0.5,\ -1,\ 0.5)^t$, and

$$f=0.25+1+0.25=1.5.$$

Orthogonality check. $c_1^tr=0.5-1+0.5=0$, $c_2^tr=0-1+1=0$: the residual is orthogonal to the columns, which is exactly $A^t(b-Ax)=0$.

Why this is a minimum, not just a candidate. For any $x$: $b-Ax=r+A(x_*-x)$, where $x_*=(1.5,\ 0.5)^t$. Since $r^tA=0$, the cross term vanishes: $\lVert b-Ax\rVert^2=\lVert r\rVert^2+\lVert A(x_*-x)\rVert^2\ge\lVert r\rVert^2=1.5$.

m0215ступень 3step 3обязательнаяrequiredCM.15CM.16лекция, 3:41:56lecture, 3:41:56
RU

Распределение $p=(p^1,p^2,p^3)^t$ на трёх исходах удовлетворяет условиям $p^1+p^2+p^3=1$ и $p^1=0.4$. Найдите наибольшее значение энтропии $H(p)=-\sum_{i=1}^{3}p^i\ln p^i$ при этих ограничениях, считая, что оно достигается в точке со всеми $p^i>0$. Ответ округлите до четырёх знаков после запятой.

EN

A distribution $p=(p^1,p^2,p^3)^t$ on three outcomes satisfies $p^1+p^2+p^3=1$ and $p^1=0.4$. Find the largest value of the entropy $H(p)=-\sum_{i=1}^{3}p^i\ln p^i$ under these constraints, assuming it is attained at a point with all $p^i>0$. Round your answer to four decimal places.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Ограничений два: $g_1=p^1+p^2+p^3-1$ и $g_2=p^1-0.4$. Удобнее минимизировать $f=\sum p^i\ln p^i$ и записать $\nabla f=\lambda_1\nabla g_1+\lambda_2\nabla g_2$.

EN

There are two constraints: $g_1=p^1+p^2+p^3-1$ and $g_2=p^1-0.4$. It is more convenient to minimize $f=\sum p^i\ln p^i$ and write $\nabla f=\lambda_1\nabla g_1+\lambda_2\nabla g_2$.

Подсказка 2 из 2Hint 2 of 2
RU

Вторая и третья координаты этого равенства: $\ln p^2+1=\lambda_1$ и $\ln p^3+1=\lambda_1$. Что отсюда следует для $p^2$ и $p^3$?

EN

The second and third coordinates of this equality are $\ln p^2+1=\lambda_1$ and $\ln p^3+1=\lambda_1$. What does this say about $p^2$ and $p^3$?

РешениеSolution
RU

Ранг. $\nabla g_1=(1,1,1)^t$, $\nabla g_2=(1,0,0)^t$ не пропорциональны, ранг $2=r<N=3$.

Система Лагранжа. $\nabla f=(\ln p^1+1,\ \ln p^2+1,\ \ln p^3+1)^t$, и

$$\ln p^1+1=\lambda_1+\lambda_2,\qquad \ln p^2+1=\lambda_1,\qquad \ln p^3+1=\lambda_1.$$

Из двух последних $\ln p^2=\ln p^3$, а логарифм принимает каждое значение один раз, поэтому $p^2=p^3$. Первое уравнение только задаёт $\lambda_2$ и ничего не ограничивает.

Ограничения. $p^1=0.4$, $p^2+p^3=0.6$, значит $p^2=p^3=0.3$.

Значение.

$$H=-0.4\ln0.4-2\cdot0.3\ln0.3=0.366516+0.722384=1.088900\approx1.0889.$$

Проверка подстановкой. $p^2=s$, $p^3=0.6-s$: $\varphi(s)=-s\ln s-(0.6-s)\ln(0.6-s)$, $\varphi'(s)=-\ln s-1+\ln(0.6-s)+1=\ln\frac{0.6-s}{s}$. Это ноль при $s=0.3$, больше нуля левее и меньше нуля правее — максимум. Ещё одна проверка: без условия $p^1=0.4$ максимум равен $\ln3\approx1.0986$, и дополнительное ограничение его уменьшило.

EN

Rank. $\nabla g_1=(1,1,1)^t$ and $\nabla g_2=(1,0,0)^t$ are not proportional; the rank is $2=r<N=3$.

Lagrange system. $\nabla f=(\ln p^1+1,\ \ln p^2+1,\ \ln p^3+1)^t$, and

$$\ln p^1+1=\lambda_1+\lambda_2,\qquad \ln p^2+1=\lambda_1,\qquad \ln p^3+1=\lambda_1.$$

From the last two, $\ln p^2=\ln p^3$, and the logarithm takes each value only once, so $p^2=p^3$. The first equation only determines $\lambda_2$ and imposes nothing.

Constraints. $p^1=0.4$, $p^2+p^3=0.6$, so $p^2=p^3=0.3$.

Value.

$$H=-0.4\ln0.4-2\cdot0.3\ln0.3=0.366516+0.722384=1.088900\approx1.0889.$$

Check by substitution. $p^2=s$, $p^3=0.6-s$: $\varphi(s)=-s\ln s-(0.6-s)\ln(0.6-s)$, $\varphi'(s)=-\ln s-1+\ln(0.6-s)+1=\ln\frac{0.6-s}{s}$. This is zero at $s=0.3$, positive to the left and negative to the right — a maximum. One more check: without the condition $p^1=0.4$ the maximum is $\ln3\approx1.0986$, and the extra constraint lowered it.

Ступень 4 · ФиналStep 4 · Final

решено 0 из 40 of 4 solved

Уровень лекции и домашнего задания. Решай без подсказок.Lecture and homework level. Solve without hints.

m0216ступень 4step 4обязательнаяrequiredCM.9по мотивам ДЗ HW-M02, п. 1based on homework HW-M02, item 1
RU

Пусть $a=(1,2)^t$, $b=(1,-1)^t$, $f(X)=a^tX^2b$ для $X\in M_{2\times2}$ и $X_0=\begin{pmatrix}1&1\\0&2\end{pmatrix}$. Найдите элемент в строке 2, столбце 1 матрицы $Z=Df(X_0)$ в соглашении лектора: $f(X_0+U)-f(X_0)=\tr(ZU)+o(\lVert U\rVert)$.

EN

Let $a=(1,2)^t$, $b=(1,-1)^t$, $f(X)=a^tX^2b$ for $X\in M_{2\times2}$, and $X_0=\begin{pmatrix}1&1\\0&2\end{pmatrix}$. Find the entry in row 2, column 1 of the matrix $Z=Df(X_0)$ in the lecturer’s convention: $f(X_0+U)-f(X_0)=\tr(ZU)+o(\lVert U\rVert)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 3Hint 1 of 3
RU

Как в m0206: раскрой $(X_0+hU)^2$, сохраняя порядок множителей, и оставь часть, линейную по $h$.

EN

As in m0206: expand $(X_0+hU)^2$, keeping the order of the factors, and keep the part linear in $h$.

Подсказка 2 из 3Hint 2 of 3
RU

Линейная часть — $a^tX_0Ub+a^tUX_0b$. Каждое слагаемое — число, то есть свой след; переставь множители по циклу так, чтобы $U$ оказалась справа.

EN

The linear part is $a^tX_0Ub+a^tUX_0b$. Each term is a number, that is, its own trace; permute the factors cyclically so that $U$ ends up on the right.

Подсказка 3 из 3Hint 3 of 3
RU

Получится $Z=b\,a^tX_0+X_0b\,a^t$. Посчитай $b\,a^t$ (матрица $2\times2$), затем оба произведения.

EN

You get $Z=b\,a^tX_0+X_0b\,a^t$. Compute $b\,a^t$ (a $2\times2$ matrix), then both products.

РешениеSolution
RU

Разложение. $(X_0+hU)^2=X_0^2+h(X_0U+UX_0)+h^2U^2$, поэтому

$$f(X_0+hU)-f(X_0)=h\big(a^tX_0Ub+a^tUX_0b\big)+h^2a^tU^2b.$$

После деления на $h$ и предела $h\to0$ остаётся $a^tX_0Ub+a^tUX_0b$.

Приведение к виду $\tr(ZU)$. Число равно своему следу, и $\tr(PQ)=\tr(QP)$. В первом слагаемом $P=a^tX_0U$ (размер $1\times2$), $Q=b$ ($2\times1$): $\tr(a^tX_0Ub)=\tr(b\,a^tX_0U)$. Во втором $P=a^t$, $Q=UX_0b$: $\tr(a^tUX_0b)=\tr(UX_0b\,a^t)=\tr(X_0b\,a^tU)$. Итого

$$Z=b\,a^tX_0+X_0b\,a^t\in M_{2\times2}.$$

Счёт. $b\,a^t=\begin{pmatrix}1\\-1\end{pmatrix}(1,\ 2)=\begin{pmatrix}1&2\\-1&-2\end{pmatrix}$.

$$b\,a^tX_0=\begin{pmatrix}1&2\\-1&-2\end{pmatrix}\begin{pmatrix}1&1\\0&2\end{pmatrix}=\begin{pmatrix}1&5\\-1&-5\end{pmatrix}.$$

$X_0b=\begin{pmatrix}1&1\\0&2\end{pmatrix}\begin{pmatrix}1\\-1\end{pmatrix}=\begin{pmatrix}0\\-2\end{pmatrix}$, поэтому $X_0b\,a^t=\begin{pmatrix}0&0\\-2&-4\end{pmatrix}$.

$$Z=\begin{pmatrix}1&5\\-3&-9\end{pmatrix}.$$

Элемент в строке 2, столбце 1 равен $-3$.

Проверка одним направлением. При $u_{12}$ в $\tr(ZU)$ стоит $z_{21}$, поэтому $z_{21}$ — производная $f$ по направлению $U=E_{12}$ (единица в строке 1, столбце 2). $X_0+hE_{12}=\begin{pmatrix}1&1+h\\0&2\end{pmatrix}$, его квадрат $\begin{pmatrix}1&3(1+h)\\0&4\end{pmatrix}$, умножение на $b$ даёт $(-2-3h,\ -4)^t$, и $a^t$ на это даёт $-2-3h-8=-10-3h$. Коэффициент при $h$ равен $-3$. Транспонированный ответ дал бы $5$.

EN

Expansion. $(X_0+hU)^2=X_0^2+h(X_0U+UX_0)+h^2U^2$, so

$$f(X_0+hU)-f(X_0)=h\big(a^tX_0Ub+a^tUX_0b\big)+h^2a^tU^2b.$$

After dividing by $h$ and letting $h\to0$, what remains is $a^tX_0Ub+a^tUX_0b$.

Bringing it to the form $\tr(ZU)$. A number equals its own trace, and $\tr(PQ)=\tr(QP)$. In the first term $P=a^tX_0U$ (size $1\times2$), $Q=b$ ($2\times1$): $\tr(a^tX_0Ub)=\tr(b\,a^tX_0U)$. In the second, $P=a^t$, $Q=UX_0b$: $\tr(a^tUX_0b)=\tr(UX_0b\,a^t)=\tr(X_0b\,a^tU)$. Altogether

$$Z=b\,a^tX_0+X_0b\,a^t\in M_{2\times2}.$$

Computation. $b\,a^t=\begin{pmatrix}1\\-1\end{pmatrix}(1,\ 2)=\begin{pmatrix}1&2\\-1&-2\end{pmatrix}$.

$$b\,a^tX_0=\begin{pmatrix}1&2\\-1&-2\end{pmatrix}\begin{pmatrix}1&1\\0&2\end{pmatrix}=\begin{pmatrix}1&5\\-1&-5\end{pmatrix}.$$

$X_0b=\begin{pmatrix}1&1\\0&2\end{pmatrix}\begin{pmatrix}1\\-1\end{pmatrix}=\begin{pmatrix}0\\-2\end{pmatrix}$, so $X_0b\,a^t=\begin{pmatrix}0&0\\-2&-4\end{pmatrix}$.

$$Z=\begin{pmatrix}1&5\\-3&-9\end{pmatrix}.$$

The entry in row 2, column 1 is $-3$.

Check along one direction. In $\tr(ZU)$ the entry $u_{12}$ is multiplied by $z_{21}$, so $z_{21}$ is the derivative of $f$ in the direction $U=E_{12}$ (a one in row 1, column 2). $X_0+hE_{12}=\begin{pmatrix}1&1+h\\0&2\end{pmatrix}$, its square is $\begin{pmatrix}1&3(1+h)\\0&4\end{pmatrix}$, multiplying by $b$ gives $(-2-3h,\ -4)^t$, and $a^t$ times that gives $-2-3h-8=-10-3h$. The coefficient of $h$ is $-3$. The transposed answer would give $5$.

m0217ступень 4step 4обязательнаяrequiredCM.11по мотивам ДЗ HW-M02, п. 3based on homework HW-M02, item 3
RU

Функция $f(x,y)$ дважды непрерывно дифференцируема, $F(u,v)=f(u^2,\ uv)$. В точке $(x,y)=(1,2)$ известно: $f_x=3$, $f_y=-1$, $f_{xx}=2$, $f_{xy}=1$, $f_{yy}=-1$ (обозначения как в m0213). Найдите $\dfrac{\partial^2F}{\partial u^2}$ в точке $(u,v)=(1,2)$.

EN

The function $f(x,y)$ is twice continuously differentiable, $F(u,v)=f(u^2,\ uv)$. At the point $(x,y)=(1,2)$ it is known that $f_x=3$, $f_y=-1$, $f_{xx}=2$, $f_{xy}=1$, $f_{yy}=-1$ (notation as in m0213). Find $\dfrac{\partial^2F}{\partial u^2}$ at the point $(u,v)=(1,2)$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

$\frac{\partial F}{\partial u}=f_x\cdot2u+f_y\cdot v$. Каждое слагаемое — произведение, и в первом от $u$ зависят оба множителя.

EN

$\frac{\partial F}{\partial u}=f_x\cdot2u+f_y\cdot v$. Each term is a product, and in the first one both factors depend on $u$.

Подсказка 2 из 2Hint 2 of 2
RU

Производная $f_x(u^2,uv)$ по $u$ равна $f_{xx}\cdot2u+f_{xy}\cdot v$, производная $f_y(u^2,uv)$ по $u$ равна $f_{xy}\cdot2u+f_{yy}\cdot v$. Не забудь слагаемое $f_x\cdot\frac{\partial}{\partial u}(2u)$.

EN

The derivative of $f_x(u^2,uv)$ in $u$ is $f_{xx}\cdot2u+f_{xy}\cdot v$; the derivative of $f_y(u^2,uv)$ in $u$ is $f_{xy}\cdot2u+f_{yy}\cdot v$. Do not forget the term $f_x\cdot\frac{\partial}{\partial u}(2u)$.

РешениеSolution
RU

Первая производная. $x=u^2$, $y=uv$, $\frac{\partial x}{\partial u}=2u$, $\frac{\partial y}{\partial u}=v$:

$$\frac{\partial F}{\partial u}=f_x\cdot2u+f_y\cdot v.$$

Вторая производная. Первое слагаемое — произведение $f_x(u^2,uv)$ и $2u$, по правилу произведения и цепному правилу его производная равна $\big(f_{xx}\cdot2u+f_{xy}\cdot v\big)\cdot2u+f_x\cdot2$. Во втором слагаемом $v$ от $u$ не зависит, производная равна $\big(f_{yx}\cdot2u+f_{yy}\cdot v\big)\cdot v$. Итого, с $f_{yx}=f_{xy}$:

$$\frac{\partial^2F}{\partial u^2}=\big(2u\,f_{xx}+v\,f_{xy}\big)2u+2f_x+\big(2u\,f_{xy}+v\,f_{yy}\big)v.$$

Подстановка $u=1$, $v=2$.

$$\big(2f_{xx}+2f_{xy}\big)\cdot2+2f_x+\big(2f_{xy}+2f_{yy}\big)\cdot2=4f_{xx}+8f_{xy}+4f_{yy}+2f_x=8+8-4+6=18.$$

Слагаемое $2f_x=6$ появилось из-за $\frac{\partial^2x}{\partial u^2}=2\ne0$; без него вышло бы $12$.

Проверка на конкретной функции. Многочлен $f=3(x-1)-(y-2)+(x-1)^2+(x-1)(y-2)-\frac12(y-2)^2$ имеет в точке $(1,2)$ ровно эти производные. При $v=2$ положим $w=u-1$: $x-1=u^2-1=2w+w^2$, $y-2=2u-2=2w$. С точностью до $w^2$:

$$F=3(2w+w^2)-2w+(2w)^2+(2w)(2w)-\tfrac12(2w)^2+\dots=4w+9w^2+\dots,$$

и $\frac{\partial^2F}{\partial u^2}=2\cdot9=18$.

EN

First derivative. $x=u^2$, $y=uv$, $\frac{\partial x}{\partial u}=2u$, $\frac{\partial y}{\partial u}=v$:

$$\frac{\partial F}{\partial u}=f_x\cdot2u+f_y\cdot v.$$

Second derivative. The first term is the product of $f_x(u^2,uv)$ and $2u$; by the product rule and the chain rule its derivative is $\big(f_{xx}\cdot2u+f_{xy}\cdot v\big)\cdot2u+f_x\cdot2$. In the second term $v$ does not depend on $u$, and the derivative is $\big(f_{yx}\cdot2u+f_{yy}\cdot v\big)\cdot v$. Altogether, with $f_{yx}=f_{xy}$:

$$\frac{\partial^2F}{\partial u^2}=\big(2u\,f_{xx}+v\,f_{xy}\big)2u+2f_x+\big(2u\,f_{xy}+v\,f_{yy}\big)v.$$

Substituting $u=1$, $v=2$.

$$\big(2f_{xx}+2f_{xy}\big)\cdot2+2f_x+\big(2f_{xy}+2f_{yy}\big)\cdot2=4f_{xx}+8f_{xy}+4f_{yy}+2f_x=8+8-4+6=18.$$

The term $2f_x=6$ appeared because $\frac{\partial^2x}{\partial u^2}=2\ne0$; without it you would get $12$.

Check on a concrete function. The polynomial $f=3(x-1)-(y-2)+(x-1)^2+(x-1)(y-2)-\frac12(y-2)^2$ has exactly these derivatives at $(1,2)$. At $v=2$ set $w=u-1$: $x-1=u^2-1=2w+w^2$, $y-2=2u-2=2w$. Up to $w^2$:

$$F=3(2w+w^2)-2w+(2w)^2+(2w)(2w)-\tfrac12(2w)^2+\dots=4w+9w^2+\dots,$$

and $\frac{\partial^2F}{\partial u^2}=2\cdot9=18$.

m0218ступень 4step 4минимумminimumCM.14доска, фото 09board, photo 09
RU

Линейная регрессия $y\approx w^1+w^2t$ обучается на четырёх точках $(t,y)$: $(0,1)$, $(1,3)$, $(2,4)$, $(3,8)$ — минимизацией суммы квадратов ошибок $\sum_k(y_k-w^1-w^2t_k)^2$. Найдите прогноз $w^1+4w^2$ обученной модели в точке $t=4$. Ответ дайте точно.

EN

A linear regression $y\approx w^1+w^2t$ is trained on four points $(t,y)$: $(0,1)$, $(1,3)$, $(2,4)$, $(3,8)$ — by minimizing the sum of squared errors $\sum_k(y_k-w^1-w^2t_k)^2$. Find the prediction $w^1+4w^2$ of the trained model at $t=4$. Give the exact answer.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Запиши функцию потерь как $\lVert b-Aw\rVert^2$: строки $A$ — $(1,\ t_k)$, столбец $b$ — значения $y_k$. Минимум даётся нормальными уравнениями.

EN

Write the loss as $\lVert b-Aw\rVert^2$: the rows of $A$ are $(1,\ t_k)$, the column $b$ holds the values $y_k$. The minimum is given by the normal equations.

Подсказка 2 из 2Hint 2 of 2
RU

$A^tA=\begin{pmatrix}4&6\\6&14\end{pmatrix}$, $A^tb=(16,\ 35)^t$.

EN

$A^tA=\begin{pmatrix}4&6\\6&14\end{pmatrix}$, $A^tb=(16,\ 35)^t$.

РешениеSolution
RU

Матрицы. $A=\begin{pmatrix}1&0\\1&1\\1&2\\1&3\end{pmatrix}$, $b=(1,3,4,8)^t$, $w=(w^1,w^2)^t$. $A^tA=\begin{pmatrix}4&0+1+2+3\\0+1+2+3&0+1+4+9\end{pmatrix}=\begin{pmatrix}4&6\\6&14\end{pmatrix}$, $A^tb=(1+3+4+8,\ 0+3+8+24)^t=(16,\ 35)^t$.

Нормальные уравнения. $4w^1+6w^2=16$, $6w^1+14w^2=35$. Умножаем первое на $1.5$: $6w^1+9w^2=24$; вычитаем из второго: $5w^2=11$, $w^2=2.2$. Тогда $w^1=\frac{16-6\cdot2.2}{4}=\frac{2.8}{4}=0.7$.

Прогноз. $w^1+4w^2=0.7+8.8=9.5$.

Проверка. Невязка $b-Aw=(1-0.7,\ 3-2.9,\ 4-5.1,\ 8-7.3)^t=(0.3,\ 0.1,\ -1.1,\ 0.7)^t$. Сумма её координат $0.3+0.1-1.1+0.7=0$, а сумма с весами $t_k$ равна $0+0.1-2.2+2.1=0$: невязка ортогональна обоим столбцам $A$. Определитель $A^tA$ равен $56-36=20\ne0$, решение единственно, и по рассуждению из m0214 оно даёт минимум.

Зачем это в ML

Это обучение линейной регрессии без градиентного спуска: признак $t$ плюс столбец единиц для свободного члена.

EN

Matrices. $A=\begin{pmatrix}1&0\\1&1\\1&2\\1&3\end{pmatrix}$, $b=(1,3,4,8)^t$, $w=(w^1,w^2)^t$. $A^tA=\begin{pmatrix}4&0+1+2+3\\0+1+2+3&0+1+4+9\end{pmatrix}=\begin{pmatrix}4&6\\6&14\end{pmatrix}$, $A^tb=(1+3+4+8,\ 0+3+8+24)^t=(16,\ 35)^t$.

Normal equations. $4w^1+6w^2=16$, $6w^1+14w^2=35$. Multiply the first by $1.5$: $6w^1+9w^2=24$; subtract it from the second: $5w^2=11$, $w^2=2.2$. Then $w^1=\frac{16-6\cdot2.2}{4}=\frac{2.8}{4}=0.7$.

Prediction. $w^1+4w^2=0.7+8.8=9.5$.

Check. The residual is $b-Aw=(1-0.7,\ 3-2.9,\ 4-5.1,\ 8-7.3)^t=(0.3,\ 0.1,\ -1.1,\ 0.7)^t$. The sum of its coordinates is $0.3+0.1-1.1+0.7=0$, and the sum weighted by $t_k$ is $0+0.1-2.2+2.1=0$: the residual is orthogonal to both columns of $A$. The determinant of $A^tA$ is $56-36=20\ne0$, the solution is unique, and by the argument from m0214 it gives the minimum.

Why this matters for ML

This is training a linear regression without gradient descent: the feature $t$ plus a column of ones for the intercept.

m0220ступень 4step 4минимумminimumCM.15CM.16лекция, 3:53:52lecture, 3:53:52
RU

Случайная величина принимает значения $0, 1, 2$ с вероятностями $p^1, p^2, p^3$. Среди распределений со средним $0\cdot p^1+1\cdot p^2+2\cdot p^3=\frac{10}{7}$ найдите распределение максимальной энтропии $H(p)=-\sum_ip^i\ln p^i$, считая, что максимум достигается в точке со всеми $p^i>0$. В ответе укажите $p^3$. Ответ округлите до четырёх знаков после запятой.

EN

A random variable takes the values $0, 1, 2$ with probabilities $p^1, p^2, p^3$. Among the distributions with mean $0\cdot p^1+1\cdot p^2+2\cdot p^3=\frac{10}{7}$, find the distribution of maximum entropy $H(p)=-\sum_ip^i\ln p^i$, assuming the maximum is attained at a point with all $p^i>0$. Give $p^3$ as your answer. Round your answer to four decimal places.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Ограничений два: $\sum_ip^i=1$ и заданное среднее. Минимизируй $f=\sum_ip^i\ln p^i$; условие Лагранжа: $\ln p^i+1=\lambda_1+\lambda_2k_i$, где $k_i$ — значение $i$-го исхода.

EN

There are two constraints: $\sum_ip^i=1$ and the given mean. Minimize $f=\sum_ip^i\ln p^i$; the Lagrange condition is $\ln p^i+1=\lambda_1+\lambda_2k_i$, where $k_i$ is the value of the $i$-th outcome.

Подсказка 2 из 2Hint 2 of 2
RU

Отсюда $p^i=C\,q^{k_i}$ с $C=e^{\lambda_1-1}$ и $q=e^{\lambda_2}>0$, то есть распределение $(C,\ Cq,\ Cq^2)$. Подставь его в оба ограничения и получи квадратное уравнение на $q$.

EN

Hence $p^i=C\,q^{k_i}$ with $C=e^{\lambda_1-1}$ and $q=e^{\lambda_2}>0$, that is, the distribution $(C,\ Cq,\ Cq^2)$. Substitute it into both constraints and get a quadratic equation for $q$.

РешениеSolution
RU

Ранг. $\nabla g_1=(1,1,1)^t$, $\nabla g_2=(0,1,2)^t$ не пропорциональны, ранг $2=r<N=3$.

Система Лагранжа. $\ln p^i+1=\lambda_1+\lambda_2k_i$ при $k=(0,1,2)$, поэтому $p^i=e^{\lambda_1-1}e^{\lambda_2k_i}=C\,q^{k_i}$: $p=(C,\ Cq,\ Cq^2)$.

Ограничения.

$$C(1+q+q^2)=1,\qquad C(q+2q^2)=\frac{10}{7}.$$

Делим второе на первое: $\frac{q+2q^2}{1+q+q^2}=\frac{10}{7}$, то есть $7q+14q^2=10+10q+10q^2$ и

$$4q^2-3q-10=0,\qquad q=\frac{3\pm\sqrt{9+160}}{8}=\frac{3\pm13}{8}.$$

Корни $2$ и $-\frac54$; так как $q=e^{\lambda_2}>0$, остаётся $q=2$. Тогда $C=\frac{1}{1+2+4}=\frac17$.

Ответ. $p=\big(\frac17,\ \frac27,\ \frac47\big)$, $p^3=\frac47\approx0.5714$.

Проверка. Сумма $\frac{1+2+4}{7}=1$, среднее $\frac{2}{7}+\frac{8}{7}=\frac{10}{7}$. Без ограничения на среднее получилось бы равномерное распределение со средним $1$; требуемое среднее $\frac{10}{7}>1$ сдвигает вероятность к большим значениям, как и вышло.

Зачем это в ML

$p^i=\frac{e^{\lambda_2k_i}}{\sum_je^{\lambda_2k_j}}$ при $\lambda_2=\ln2$ — это softmax от чисел $\lambda_2k_i$. Распределения вида softmax — ровно те, что максимизируют энтропию при линейных ограничениях на средние.

EN

Rank. $\nabla g_1=(1,1,1)^t$ and $\nabla g_2=(0,1,2)^t$ are not proportional; the rank is $2=r<N=3$.

Lagrange system. $\ln p^i+1=\lambda_1+\lambda_2k_i$ with $k=(0,1,2)$, so $p^i=e^{\lambda_1-1}e^{\lambda_2k_i}=C\,q^{k_i}$: $p=(C,\ Cq,\ Cq^2)$.

Constraints.

$$C(1+q+q^2)=1,\qquad C(q+2q^2)=\frac{10}{7}.$$

Divide the second by the first: $\frac{q+2q^2}{1+q+q^2}=\frac{10}{7}$, that is, $7q+14q^2=10+10q+10q^2$ and

$$4q^2-3q-10=0,\qquad q=\frac{3\pm\sqrt{9+160}}{8}=\frac{3\pm13}{8}.$$

The roots are $2$ and $-\frac54$; since $q=e^{\lambda_2}>0$, only $q=2$ remains. Then $C=\frac{1}{1+2+4}=\frac17$.

Answer. $p=\big(\frac17,\ \frac27,\ \frac47\big)$, $p^3=\frac47\approx0.5714$.

Check. The sum is $\frac{1+2+4}{7}=1$, the mean is $\frac{2}{7}+\frac{8}{7}=\frac{10}{7}$. Without the constraint on the mean we would get the uniform distribution with mean $1$; the required mean $\frac{10}{7}>1$ shifts probability toward larger values, and that is what happened.

Why this matters for ML

$p^i=\frac{e^{\lambda_2k_i}}{\sum_je^{\lambda_2k_j}}$ with $\lambda_2=\ln2$ is the softmax of the numbers $\lambda_2k_i$. Distributions of softmax form are exactly those that maximize entropy under linear constraints on means.

Мини-тест под таймеромTimed mini-test

20 минут20 minutes

Одна задача и таймер. Подсказки и решение открывай только после того, как время выйдет: это тренировка поведения на экзамене.One problem and a timer. Open hints and the solution only after time is up: this trains exam behavior.

m0219ступень 4step 4минимумminimumCM.15лекция, 3:33:07lecture, 3:33:07
RU

Найдите наименьшее значение функции $f(x,y,z)=x^2+2y^2+3z^2$ при ограничении $x+y+z=11$.

EN

Find the smallest value of the function $f(x,y,z)=x^2+2y^2+3z^2$ subject to $x+y+z=11$.

Дробную часть отделяй точкой или запятой.Use a decimal point or a comma.

УверенностьConfidence1 — наугад, 2 — есть сомнения, 3 — уверенно1 — guess, 2 — unsure, 3 — sure
Подсказка 1 из 2Hint 1 of 2
RU

Ограничение одно, $N=3$: запиши $\nabla f=\lambda\nabla g$ при $g=x+y+z-11$ и проверь ранг.

EN

There is one constraint and $N=3$: write $\nabla f=\lambda\nabla g$ with $g=x+y+z-11$ and check the rank.

Подсказка 2 из 2Hint 2 of 2
RU

Из системы $x=\frac{\lambda}{2}$, $y=\frac{\lambda}{4}$, $z=\frac{\lambda}{6}$. Подставь это в ограничение.

EN

The system gives $x=\frac{\lambda}{2}$, $y=\frac{\lambda}{4}$, $z=\frac{\lambda}{6}$. Substitute this into the constraint.

РешениеSolution
RU

Существование. $f\ge x^2+y^2+z^2$, поэтому на плоскости $f\to\infty$ при удалении точки на бесконечность; минимум существует, максимума нет.

Ранг. $\nabla g=(1,1,1)^t\ne0$, ранг $1=r<N=3$.

Система. $\nabla f=(2x,\ 4y,\ 6z)^t=\lambda(1,1,1)^t$: $x=\frac{\lambda}{2}$, $y=\frac{\lambda}{4}$, $z=\frac{\lambda}{6}$. Уравнений $4$, неизвестных $4$.

Ограничение.

$$\lambda\Big(\frac12+\frac14+\frac16\Big)=\lambda\cdot\frac{6+3+2}{12}=\frac{11\lambda}{12}=11\ \Rightarrow\ \lambda=12.$$

Отсюда $x=6$, $y=3$, $z=2$; проверка ограничения: $6+3+2=11$.

Значение. $f=36+2\cdot9+3\cdot4=36+18+12=66$.

Проверка подстановкой. $z=11-x-y$, $\varphi(x,y)=x^2+2y^2+3(11-x-y)^2$. Условия $\varphi_x=2x-6(11-x-y)=0$ и $\varphi_y=4y-6(11-x-y)=0$ дают $2x=4y$, $x=2y$; затем $4y=6(11-3y)$, $22y=66$, $y=3$, $x=6$, $z=2$. Та же точка.

EN

Existence. $f\ge x^2+y^2+z^2$, so on the plane $f\to\infty$ as the point moves off to infinity; a minimum exists, a maximum does not.

Rank. $\nabla g=(1,1,1)^t\ne0$, the rank is $1=r<N=3$.

System. $\nabla f=(2x,\ 4y,\ 6z)^t=\lambda(1,1,1)^t$: $x=\frac{\lambda}{2}$, $y=\frac{\lambda}{4}$, $z=\frac{\lambda}{6}$. There are $4$ equations and $4$ unknowns.

Constraint.

$$\lambda\Big(\frac12+\frac14+\frac16\Big)=\lambda\cdot\frac{6+3+2}{12}=\frac{11\lambda}{12}=11\ \Rightarrow\ \lambda=12.$$

Hence $x=6$, $y=3$, $z=2$; checking the constraint: $6+3+2=11$.

Value. $f=36+2\cdot9+3\cdot4=36+18+12=66$.

Check by substitution. $z=11-x-y$, $\varphi(x,y)=x^2+2y^2+3(11-x-y)^2$. The conditions $\varphi_x=2x-6(11-x-y)=0$ and $\varphi_y=4y-6(11-x-y)=0$ give $2x=4y$, $x=2y$; then $4y=6(11-3y)$, $22y=66$, $y=3$, $x=6$, $z=2$. The same point.

Домашнее заданиеHomework

HW-M02

(1) Z = Df(X₀) для f(X) = aᵗX⁻¹b; (2) полярные координаты: f_x, f_y через f_r, f_θ, затем лапласиан на плоскости; (3) лапласиан в сферических координатах в ℝ³; (4) выписать формулу Тейлора для функции многих переменных через g⁽ᵏ⁾; (5) вывести ∇f = Σλᵢ∇gᵢ из геометрического условия; (6) по желанию: оптическое свойство эллипса(1) Z = Df(X₀) for f(X) = aᵗX⁻¹b; (2) polar: f_x, f_y via f_r, f_θ, then 2D Laplacian; (3) spherical 3D Laplacian; (4) write out multivariable Taylor from g⁽ᵏ⁾; (5) derive ∇f = Σλᵢ∇gᵢ from geometric condition; (6) optional: ellipse reflection property

Срок:Due: 16 октября 2026October 16, 2026 · статус:status: не начатоto do просроченоoverdue

как готовитьсяhow to prepare
RU

Задание HW-M02 (лекция 14 октября, срок — следующая лекция). Здесь только условия и подсказки: решения проверяет тьютор.

  1. $Z=Df(X_0)$ для $f(X)=a^tX^{-1}b$, $a,b\in\R^N$, $X$ — обратимая матрица $N\times N$: найти матрицу $Z$, для которой $\lim_{h\to0}\frac{f(X_0+hU)-f(X_0)}{h}=\tr(ZU)$ при всех $U$. Подсказка лектора: сначала выясни, как выглядит $(X_0+hU)^{-1}-X_0^{-1}$; умножь эту разность на $(X_0+hU)$ слева. Готовят m0206, m0211, m0216: тот же приём на многочленах от $X$, без обратной матрицы.
  2. Полярные координаты: выразить $\partial f/\partial x$, $\partial f/\partial y$ через $\partial f/\partial r$, $\partial f/\partial\theta$, $r$, $\theta$, затем лапласиан $\frac{\partial^2f}{\partial x^2}+\frac{\partial^2f}{\partial y^2}$. Подсказка: первая часть — система $2\times2$; во второй применяй к $\partial f/\partial x$ ту же формулу ещё раз. Готовят m0203, m0208, m0213.
  3. Сферические координаты $x=\rho\sin\varphi\cos\theta$, $y=\rho\sin\varphi\sin\theta$, $z=\rho\cos\varphi$: трёхмерный лапласиан. Подсказка: та же схема, матрица замены $3\times3$; проверяй результат на $f=x^2+y^2+z^2$. Готовит m0217.
  4. Конечная формула Тейлора для $f:\R^N\to\R$, записанная через $g^{(k)}$. Готовят m0207, m0212.
  5. Вывести $\nabla f=\sum\lambda_i\nabla g_i$ из условия «линия уровня касается ограничения». Подсказка: что можно сказать о градиенте функции и векторе, касательном к её множеству уровня? Готовят m0204, m0219.
  6. (По желанию) Доказать оптическое свойство эллипса через касательную.

Задачи урока тренируют те же приёмы на других функциях и числах; ни одна из них не решает пункт задания.

EN

Homework HW-M02 (lecture of October 14, due at the next lecture). Only statements and hints are here: the tutor checks the solutions.

  1. $Z=Df(X_0)$ for $f(X)=a^tX^{-1}b$, $a,b\in\R^N$, $X$ an invertible $N\times N$ matrix: find the matrix $Z$ such that $\lim_{h\to0}\frac{f(X_0+hU)-f(X_0)}{h}=\tr(ZU)$ for all $U$. The lecturer’s hint: first find out what $(X_0+hU)^{-1}-X_0^{-1}$ looks like; multiply this difference by $(X_0+hU)$ on the left. Prepared by m0206, m0211, m0216: the same technique on polynomials in $X$, without the inverse.
  2. Polar coordinates: express $\partial f/\partial x$, $\partial f/\partial y$ through $\partial f/\partial r$, $\partial f/\partial\theta$, $r$, $\theta$, then the Laplacian $\frac{\partial^2f}{\partial x^2}+\frac{\partial^2f}{\partial y^2}$. Hint: the first part is a $2\times2$ system; in the second, apply the same formula to $\partial f/\partial x$ once more. Prepared by m0203, m0208, m0213.
  3. Spherical coordinates $x=\rho\sin\varphi\cos\theta$, $y=\rho\sin\varphi\sin\theta$, $z=\rho\cos\varphi$: the three-dimensional Laplacian. Hint: the same scheme with a $3\times3$ change matrix; test your result on $f=x^2+y^2+z^2$. Prepared by m0217.
  4. The finite Taylor formula for $f:\R^N\to\R$, written through $g^{(k)}$. Prepared by m0207, m0212.
  5. Derive $\nabla f=\sum\lambda_i\nabla g_i$ from the condition “the level curve is tangent to the constraint.” Hint: what can you say about the gradient of a function and a vector tangent to its level set? Prepared by m0204, m0219.
  6. (Optional) Prove the reflection property of the ellipse via the tangent line.

The lesson’s problems train the same techniques on other functions and numbers; none of them solves a homework item.

ИтогWrap-up

урок закрыт, когдаthe lesson is complete when
Производную $f(X)$ по матрице для многочлена степени 2 по $X$ выписываешь за 5 минут и сразу проверяешь размер $n\times m$: m0206, m0211, m0216 без транспонированного ответаYou write the matrix derivative of $f(X)$ for a polynomial of degree 2 in $X$ within 5 minutes and check the size $n\times m$ right away: m0206, m0211, m0216 without a transposed answer
Вторую производную сложной функции при нелинейной замене считаешь без подсказки, и слагаемое с первой производной на месте: m0213 и m0217 верно с первой попыткиYou compute a second derivative of a composite function under a nonlinear change without hints, with the first-derivative term in place: m0213 and m0217 correct on the first attempt
Перед поиском экстремума вслух называешь, внутренняя ли точка и существует ли минимум; в m0210 граница проверена до ответаBefore looking for an extremum you say out loud whether the point is interior and whether the minimum exists; in m0210 the boundary is checked before the answer
Нормальные уравнения для регрессии с двумя параметрами составляешь и решаешь за 10 минут и проверяешь, что невязка ортогональна столбцам: m0214, m0218You set up and solve the normal equations for a two-parameter regression within 10 minutes and check that the residual is orthogonal to the columns: m0214, m0218
Систему Лагранжа записываешь с подсчётом уравнений и проверкой ранга: мини-тест m0219 за 20 минут с первого вводаYou write the Lagrange system with a count of equations and a rank check: the mini-test m0219 within 20 minutes on the first entry
аудит урокаlesson audit
RU

Запиши в журнал каждую ошибку отдельной строкой и отметь тип. Первый тип — соглашение: ответ транспонирован, $u$ оказался слева, в ответе осталось $t$. Второй — цепное правило: потеряно слагаемое с $\partial^2x/\partial s^2$ или не продифференцирована частная производная. Третий — логика оптимизации: не проверена граница, не выяснено, существует ли минимум, не сосчитаны уравнения. Третий тип опаснее всего: ответ выглядит правдоподобно.

EN

Write each mistake in the error log on its own line and mark its type. Type one is the convention: the answer is transposed, $u$ ended up on the left, $t$ remained in the answer. Type two is the chain rule: the term with $\partial^2x/\partial s^2$ was lost, or a partial derivative was not differentiated. Type three is optimization logic: the boundary was not checked, nobody asked whether the minimum exists, the equations were not counted. Type three is the most dangerous: the answer looks plausible.