{
  "id": "legendre-transform",
  "title": "Legendre Transform",
  "lang": "en",
  "source_lang": "en",
  "summary": "The Legendre transform replaces a function’s variables with conjugate variables, linking convex geometry, optimization, classical mechanics, and thermodynamics.",
  "category": "mathematics",
  "subcategory": "analysis",
  "type": "concept",
  "aliases": [
    "Legendre transformation"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/legendre-transform/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/legendre-transform/",
      "json": "https://aiwiki.page/zh/legendre-transform.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The Legendre transform is a mathematical transformation that replaces the independent variables of a function with variables representing its slopes. For a differentiable, strictly convex function \\(f(x)\\), it constructs a new function \\(f^*(p)=px-f(x)\\), where \\(x\\) is determined by \\(p=f'(x)\\). Its more general form, the Legendre–Fenchel transform, defines \\(f^*(p)\\) as the supremum of \\(px-f(x)\\), without requiring differentiability or strict convexity. The transformation connects the geometry of convex functions with dual descriptions in optimization, mechanics, and thermodynamics."
    },
    {
      "heading": "Definition",
      "text": "For a function \\(f:\\mathbb{R}^n\\to\\mathbb{R}\\cup\\{+\\infty\\}\\), its Legendre–Fenchel transform, also called its convex conjugate, is\n\n\\[f^*(p)=\\sup_{x\\in\\mathbb{R}^n} \\bigl\\{\\langle p,x\\rangle-f(x)\\bigr\\},\\]\n\nwhere \\(\\langle p,x\\rangle\\) is the Euclidean inner product. Allowing the value \\(+\\infty\\) makes it possible to include constraints: setting \\(f(x)=+\\infty\\) outside an allowed set excludes those points from the supremum.\n\nThe effective domain of \\(f^*\\) consists of the vectors \\(p\\) for which this supremum is finite. Even when \\(f\\) is finite everywhere, its conjugate need not be.\n\nMore generally, if \\(f\\) is defined on a real vector space \\(X\\), the conjugate is defined on an appropriate dual space \\(X^*\\):\n\n\\[f^*(p)=\\sup_{x\\in X} \\bigl\\{\\langle p,x\\rangle-f(x)\\bigr\\}.\\]\n\nHere \\(\\langle p,x\\rangle\\) denotes evaluation of a linear functional, rather than necessarily an inner product. In infinite-dimensional settings, the choice of topology and continuous dual matters.\n\nThe terminology is not completely uniform. “Legendre transform” often means the smooth, invertible construction, while “Legendre–Fenchel transform” emphasizes the supremum definition. Many texts use “Legendre transform” for both."
    },
    {
      "heading": "Smooth construction and geometric meaning",
      "text": "Suppose that \\(f\\) is differentiable on an open convex domain. An interior maximizer of \\(px-f(x)\\) must satisfy\n\n\\[p=f'(x).\\]\n\nIf \\(f\\) is strictly convex, its derivative is strictly increasing, so this equation has at most one solution. For \\(p\\) in the derivative’s range, write that solution as \\(x=x(p)\\). Then\n\n\\[f^*(p)=p\\,x(p)-f(x(p)).\\]\n\nDifferentiating gives\n\n\\[\\frac{d f^*}{dp}=x(p).\\]\n\nThus the original and transformed functions exchange the roles of position and slope:\n\n\\[p=f'(x), \\qquad x=(f^*)'(p).\\]\n\nStrict convexity ensures uniqueness, but does not by itself guarantee that every real slope occurs.\n\nGeometrically, the tangent line to \\(f\\) at \\(x\\), with slope \\(p=f'(x)\\), has equation\n\n\\[y=px-f^*(p).\\]\n\nThe transform therefore records the negative vertical intercept of each supporting tangent line. The same convex curve can be described either by its points or by its supporting lines.\n\nFor a differentiable convex function of several variables, the corresponding relation uses the gradient:\n\n\\[p=\\nabla f(x), \\qquad f^*(p)=\\langle p,x\\rangle-f(x).\\]\n\nIf \\(f\\) is twice continuously differentiable and its Hessian matrix is positive definite, the gradient map is locally invertible. At corresponding points,\n\n\\[\\nabla f^*(p)=x, \\qquad \\nabla^2 f^*(p)=\\bigl[\\nabla^2 f(x)\\bigr]^{-1}.\\]\n\nThese identities explain why reciprocal response coefficients often appear in dual descriptions."
    },
    {
      "heading": "Examples",
      "text": "Quadratic functions\n\nFor\n\n\\[f(x)=\\frac{a}{2}x^2, \\qquad a>0,\\]\n\nthe maximizing condition is \\(p=ax\\), so\n\n\\[f^*(p)=\\frac{p^2}{2a}.\\]\n\nMore generally, if \\(A\\) is a symmetric positive-definite matrix and\n\n\\[f(x)=\\frac12 x^{\\mathsf T}Ax,\\]\n\nthen\n\n\\[f^*(p)=\\frac12 p^{\\mathsf T}A^{-1}p.\\]\n\nConjugation therefore inverts the matrix governing a positive-definite quadratic form.\n\nExponential function\n\nFor the exponential function \\(f(x)=e^x\\), the equation \\(p=e^x\\) gives \\(x=\\log p\\) when \\(p>0\\). Consequently,\n\n\\[f^*(p)= \\begin{cases} p\\log p-p, & p>0,\\\\ 0, & p=0,\\\\ +\\infty, & p<0. \\end{cases}\\]\n\nAt \\(p=0\\), the supremum is approached as \\(x\\to-\\infty\\), but is not attained. Thus a conjugate can have a finite value even when no maximizing point exists.\n\nAbsolute value\n\nFor \\(f(x)=|x|\\),\n\n\\[f^*(p)= \\begin{cases} 0, & |p|\\leq 1,\\\\ +\\infty, & |p|>1. \\end{cases}\\]\n\nThis illustrates how the generalized transform handles a function that is neither differentiable everywhere nor strictly convex. An interval of slopes corresponds to the single corner at \\(x=0\\)."
    },
    {
      "heading": "Convex conjugacy and recovery",
      "text": "For each fixed \\(x\\), the expression \\(\\langle p,x\\rangle-f(x)\\) is affine in \\(p\\). Its supremum is therefore convex. Accordingly, a conjugate is convex even if the original function is not. In finite dimensions it is also lower semicontinuous.\n\nFenchel–Young inequality\n\nThe definition immediately yields\n\n\\[f(x)+f^*(p)\\geq\\langle p,x\\rangle.\\]\n\nThis is the Fenchel–Young inequality. For a proper convex function, equality holds precisely when\n\n\\[p\\in\\partial f(x),\\]\n\nwhere \\(\\partial f(x)\\) is the subdifferential:\n\n\\[\\partial f(x)= \\left\\{ p: f(y)\\geq f(x)+\\langle p,y-x\\rangle \\text{ for every }y \\right\\}.\\]\n\nSubgradients generalize slopes at corners. When \\(f\\) is differentiable, \\(\\partial f(x)=\\{\\nabla f(x)\\}\\), recovering the smooth construction.\n\nBiconjugation\n\nApplying conjugation twice gives\n\n\\[f^{**}(x)=\\sup_p \\bigl\\{\\langle p,x\\rangle-f^*(p)\\bigr\\}.\\]\n\nThe Fenchel–Moreau theorem states that a proper, lower-semicontinuous convex function equals its biconjugate:\n\n\\[f^{**}=f.\\]\n\nHere “proper” means that the function never takes the value \\(-\\infty\\) and is finite somewhere.\n\nFor a nonconvex function that admits a finite affine lower bound, the biconjugate is its greatest lower-semicontinuous convex minorant. Conjugation therefore generally discards nonconvex information: applying the transform twice need not recover the original function."
    },
    {
      "heading": "Role in optimization",
      "text": "Convex conjugates are central to convex optimization and Lagrangian duality. They turn minimization over one variable into an expression involving dual variables.\n\nFor example, consider\n\n\\[\\inf_x\\{f(x)+g(Ax)\\},\\]\n\nwhere \\(A\\) is a linear map and \\(f,g\\) are proper convex functions. The associated Fenchel dual problem is\n\n\\[\\sup_y \\left\\{ -f^*(-A^{\\mathsf T}y)-g^*(y) \\right\\}.\\]\n\nWeak duality holds without requiring equality of the optimal values. Under suitable domain and continuity conditions, strong duality identifies the primal and dual values. Such equality should not be assumed solely because the objective is convex.\n\nTwo useful connections are:\n\n- If \\(\\delta_C(x)\\) is zero on a nonempty convex set \\(C\\) and \\(+\\infty\\) elsewhere, then\n\n\\[\\delta_C^*(p)=\\sup_{x\\in C}\\langle p,x\\rangle.\\]\n\nThis is the support function of \\(C\\).\n- If \\(f(x)=\\|x\\|\\) is a norm, its conjugate is zero on the closed unit ball of the dual norm and \\(+\\infty\\) outside it.\n\nThese identities explain why constraints and penalty functions frequently exchange roles in dual formulations."
    },
    {
      "heading": "Classical mechanics",
      "text": "In classical mechanics, the Legendre transform relates a Lagrangian \\(L(q,v,t)\\) to a Hamiltonian \\(H(q,p,t)\\). Positions \\(q\\) and time \\(t\\) are held fixed while velocities \\(v\\) are transformed into momenta:\n\n\\[p_i=\\frac{\\partial L}{\\partial v_i}.\\]\n\nIf the velocity-to-momentum relation can be inverted, then\n\n\\[H(q,p,t)=\\sum_i p_i v_i-L(q,v,t),\\]\n\nwith the velocities expressed in terms of \\(q,p,t\\).\n\nFor\n\n\\[L(q,v)=\\frac12 m|v|^2-V(q),\\]\n\none obtains\n\n\\[p=mv, \\qquad H(q,p)=\\frac{|p|^2}{2m}+V(q).\\]\n\nThe Euler–Lagrange equations then become Hamilton’s equations,\n\n\\[\\dot q_i=\\frac{\\partial H}{\\partial p_i}, \\qquad \\dot p_i=-\\frac{\\partial H}{\\partial q_i}.\\]\n\nA nonsingular velocity Hessian guarantees local invertibility, but does not necessarily make this construction a global convex conjugate. Agreement with the supremum definition requires additional convexity and domain conditions. Singular Lagrangians, including those arising in gauge theories, require a constrained treatment."
    },
    {
      "heading": "Thermodynamics",
      "text": "In thermodynamics, Legendre transformations replace natural variables of a thermodynamic potential with their conjugate quantities.\n\nFor a simple compressible system with fixed particle number, internal energy satisfies\n\n\\[dU=T\\,dS-P\\,dV,\\]\n\nwhere \\(T\\) is temperature, \\(S\\) is thermodynamic entropy, \\(P\\) is pressure, and \\(V\\) is volume.\n\nTransforming selected variables produces the familiar potentials:\n\nPotential | Definition | Differential at fixed particle number\nHelmholtz free energy | \\(F=U-TS\\) | \\(dF=-S\\,dT-P\\,dV\\)\nEnthalpy | \\(H=U+PV\\) | \\(dH=T\\,dS+V\\,dP\\)\nGibbs free energy | \\(G=U-TS+PV\\) | \\(dG=-S\\,dT+V\\,dP\\)\n\nThese are partial transformations: only selected independent variables are replaced.\n\nSign conventions require care. At fixed volume, for example, equilibrium Helmholtz free energy can be written as\n\n\\[F(T,V)=\\inf_S\\{U(S,V)-TS\\}.\\]\n\nIt is therefore the negative convex conjugate of \\(U\\) with respect to entropy. Thermodynamic transformations are often written as \\(f-px\\), rather than \\(px-f\\); these conventions describe related constructions but cannot be interchanged without adjusting signs.\n\nAt phase coexistence, the conjugate-variable relation may cease to be one-to-one. Nondifferentiability and affine regions are then handled more naturally by the Legendre–Fenchel formulation than by ordinary derivative inversion."
    },
    {
      "heading": "Probability and large deviations",
      "text": "For a real random variable \\(X\\), define the logarithmic moment-generating function\n\n\\[K(t)=\\log\\mathbb{E}[e^{tX}]\\]\n\nwhere the expectation is finite. Its conjugate is\n\n\\[I(x)=\\sup_t\\{tx-K(t)\\}.\\]\n\nIn large deviations theory, \\(I\\) describes the exponential decay of probabilities of atypical sample averages. For independent, identically distributed observations whose moment-generating function is finite in a neighborhood of zero, Cramér’s theorem identifies this conjugate as the rate function.\n\nFor a normal distribution with mean \\(\\mu\\) and variance \\(\\sigma^2>0\\),\n\n\\[K(t)=\\mu t+\\frac12\\sigma^2t^2, \\qquad I(x)=\\frac{(x-\\mu)^2}{2\\sigma^2}.\\]\n\nUnlike a Fourier transform or a Laplace transform, the Legendre transform is defined by optimization, not by integration. Its connection with integral transforms arises through asymptotic methods in which a dominant exponent is found by maximization."
    },
    {
      "heading": "Historical development and limitations",
      "text": "The transformation is named after Adrien-Marie Legendre, whose work introduced changes between variables and derivatives in the study of differential equations. Its later use in mechanics and thermodynamics made it a standard method for changing descriptions of a system. In the twentieth century, Werner Fenchel developed the generalized conjugate-function framework, which became foundational in convex analysis.\n\nThe principal limitations concern invertibility and information loss. A smooth formula based on \\(p=\\nabla f(x)\\) may fail because a slope is not attained, several points share a slope, or the derivative map is singular. The supremum formulation remains meaningful in these cases, but may produce infinite values or lose nonconvex features. The function’s domain, boundary behavior, convexity, and the chosen sign convention are therefore part of the transformation’s definition, not merely technical details."
    }
  ],
  "links": [
    "convex-function",
    "inner-product",
    "vector-space",
    "dual-space",
    "linear-functional",
    "derivative",
    "gradient",
    "hessian-matrix",
    "positive-definite-matrix",
    "exponential-function",
    "convex-optimization",
    "lagrangian-duality",
    "convex-set",
    "norm-mathematics",
    "classical-mechanics",
    "hamiltonian-mechanics",
    "euler-lagrange-equations",
    "thermodynamics",
    "temperature",
    "pressure",
    "random-variable",
    "normal-distribution",
    "fourier-transform",
    "laplace-transform"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}