L2 Norm in LaTeX (\| \theta \|_2)
- LaTeX command
\| \theta \|_2- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Euclidean (L2) norm of theta: the square root of the sum of its squared entries.
The L2 norm \|\theta\|_2 = \sqrt{\sum_i \theta_i^2} measures length, and its square appears as the ridge or weight-decay penalty \lambda\|\theta\|_2^2. Note the order of scripts: \|\theta\|_2^2 is the squared norm, and TeX stacks the subscript and superscript neatly. Many authors drop the subscript 2 when context is clear. For better delimiter spacing, use \lVert and \rVert instead of \|, and \left\| \right\| for tall contents like fractions. For matrices, \|A\|_2 usually means the spectral norm, not the entrywise one, which is the Frobenius norm.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
L2 Norm: $\| \theta \|_2$
\[ \mathcal{L}(\theta) + \frac{\lambda}{2} \| \theta \|_2^2 \]
\end{document}Related symbols
- Frobenius Norm
\| \mathbf{W} \|_F - L1 Norm
\| \theta \|_1 - Product Over Samples
\prod_{i=1}^{N} - Sum Over Classes
\sum_{c=1}^{C} - Conditional Probability
p(y | x) - Probability Distribution
p(x)
Frequently asked questions
- How do I write L2 Norm in LaTeX?
- Type \| \theta \|_2 in math mode, for example $\mathcal{L}(\theta) + \frac{\lambda}{2} \| \theta \|_2^2$. It works in plain LaTeX without loading any package.
- Which package do I need for \| \theta \|_2?
- None. \| \theta \|_2 is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \| \theta \|_2 in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\| \theta \|_2$ in running text.
최고의 AI LaTeX 편집기, Overleaf 대안
Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움
- AI로 아름다운 TikZ 다이어그램 생성
- 이미지를 업로드하고 LaTeX로 원활하게 변환
- 논문 작성 및 서식에 대한 즉각적인 지원 받기