Lagrangian in LaTeX (\mathcal{L}(x, \lambda))

L(x,λ)\mathcal{L}(x, \lambda)
LaTeX command
\mathcal{L}(x, \lambda)
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Lagrangian function combining an objective with its constraints weighted by multipliers lambda.

The Lagrangian is \mathcal{L}(x, \lambda, \nu) = f(x) + \sum_i \lambda_i g_i(x) + \sum_j \nu_j h_j(x), and the dual function is its infimum over x. Setting \nabla_x \mathcal{L} = 0 gives the stationarity condition used in constrained calculus problems and SVM derivations. \mathcal gives the script L and only works for uppercase letters. Because the same \mathcal{L} also denotes losses in machine learning, papers mixing both sometimes write L or \Lambda for one of them. Some textbooks use the opposite sign convention, f - \lambda g, so state yours.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

L(x,λ)=f(x)+∑i=1mλigi(x)\mathcal{L}(x, \lambda) = f(x) + \sum_{i=1}^{m} \lambda_i g_i(x)
\documentclass{article}
\begin{document}
Lagrangian: $\mathcal{L}(x, \lambda)$

\[ \mathcal{L}(x, \lambda) = f(x) + \sum_{i=1}^{m} \lambda_i g_i(x) \]
\end{document}

Related symbols

All التحسين →

Frequently asked questions

How do I write Lagrangian in LaTeX?
Type \mathcal{L}(x, \lambda) in math mode, for example $\mathcal{L}(x, \lambda) = f(x) + \sum_{i=1}^{m} \lambda_i g_i(x)$. It works in plain LaTeX without loading any package.
Which package do I need for \mathcal{L}(x, \lambda)?
None. \mathcal{L}(x, \lambda) is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \mathcal{L}(x, \lambda) in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\mathcal{L}(x, \lambda)$ in running text.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث