{
  "id": "digamma-function",
  "title": "Digamma Function",
  "lang": "en",
  "source_lang": "en",
  "summary": "The digamma function is the logarithmic derivative of the gamma function, connecting harmonic sums, special-function identities, and statistical parameter estimation.",
  "category": "mathematics",
  "subcategory": "analysis",
  "type": "concept",
  "aliases": [
    "Psi function",
    "Euler psi function"
  ],
  "generated_at": "2026-11-06",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/digamma-function/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/digamma-function/",
      "json": "https://aiwiki.page/zh/digamma-function.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The digamma function, usually written \\(\\psi(z)\\), is the logarithmic derivative of the gamma function:\n\n\\[\\psi(z)=\\frac{\\Gamma'(z)}{\\Gamma(z)}.\\]\n\nIt extends the relationship between harmonic sums and logarithms to real and complex arguments. The digamma function is a basic special function in mathematical analysis and occurs in the evaluation of infinite sums, differentiation of special functions, and statistical calculations involving gamma, beta, and Dirichlet distributions."
    },
    {
      "heading": "Definition and analytic structure",
      "text": "Where a local logarithm of \\(\\Gamma(z)\\) is defined, the defining relation can also be written\n\n\\[\\psi(z)=\\frac{d}{dz}\\log\\Gamma(z).\\]\n\nThe quotient \\(\\Gamma'(z)/\\Gamma(z)\\) is the more general formulation: it does not require a global choice of logarithm.\n\nAs a function of a complex variable, \\(\\psi\\) is meromorphic on the complex plane. It is analytic except for simple poles at\n\n\\[z=0,-1,-2,\\ldots,\\]\n\neach with residue \\(-1\\). These poles arise from the poles of the gamma function; the gamma function itself has no zeros.\n\nNear \\(z=-n\\), where \\(n\\) is a nonnegative integer,\n\n\\[\\psi(z) = -\\frac{1}{z+n}+H_n-\\gamma+O(z+n),\\]\n\nwhere \\(H_0=0\\),\n\n\\[H_n=\\sum_{k=1}^{n}\\frac1k,\\]\n\nand \\(\\gamma\\) is the Euler–Mascheroni constant:\n\n\\[\\gamma=\\lim_{n\\to\\infty}(H_n-\\log n).\\]\n\nThe digamma function is not the same as the Barnes double gamma function. In particular, “digamma” names a logarithmic derivative, not an iteration of the gamma function."
    },
    {
      "heading": "Recurrence and functional identities",
      "text": "Recurrence relation\n\nDifferentiating the gamma identity \\(\\Gamma(z+1)=z\\Gamma(z)\\) gives the recurrence relation\n\n\\[\\boxed{\\psi(z+1)=\\psi(z)+\\frac1z.}\\]\n\nRepeated application yields\n\n\\[\\psi(z+n)=\\psi(z)+\\sum_{k=0}^{n-1}\\frac{1}{z+k},\\]\n\nfor positive integers \\(n\\), wherever the expressions are defined. Thus a finite sum of reciprocals in an arithmetic progression can be expressed as a difference of digamma values.\n\nSince \\(\\psi(1)=-\\gamma\\), the recurrence gives\n\n\\[\\psi(n)=H_{n-1}-\\gamma, \\qquad n=1,2,\\ldots.\\]\n\nThe digamma function therefore provides an extension of harmonic numbers beyond integer arguments:\n\n\\[H_z=\\psi(z+1)+\\gamma.\\]\n\nReflection formula\n\nLogarithmic differentiation of the gamma reflection formula gives\n\n\\[\\boxed{\\psi(1-z)-\\psi(z)=\\pi\\cot(\\pi z),}\\]\n\nfor noninteger \\(z\\). This identity relates values on opposite sides of \\(1/2\\) and is useful for transforming arguments with negative real part.\n\nMultiplication formula\n\nFor a positive integer \\(m\\),\n\n\\[\\sum_{k=0}^{m-1} \\psi\\!\\left(z+\\frac{k}{m}\\right) = m\\psi(mz)-m\\log m.\\]\n\nThe case \\(m=2\\) is the duplication identity:\n\n\\[\\psi(z)+\\psi\\!\\left(z+\\frac12\\right) = 2\\psi(2z)-2\\log 2.\\]\n\nTogether, recurrence, reflection, and multiplication formulas produce many exact values at rational arguments."
    },
    {
      "heading": "Series and integral representations",
      "text": "A fundamental series representation is\n\n\\[\\psi(z) = -\\gamma+ \\sum_{n=0}^{\\infty} \\left(\\frac{1}{n+1}-\\frac{1}{n+z}\\right),\\]\n\nvalid away from the poles. The paired summands decay as \\(n^{-2}\\), and the series converges uniformly on compact sets avoiding those poles.\n\nAn equivalent form is\n\n\\[\\psi(z+1) = -\\gamma+ \\sum_{n=1}^{\\infty}\\frac{z}{n(n+z)}.\\]\n\nFor \\(\\operatorname{Re}z>0\\), an integral representation is\n\n\\[\\psi(z)+\\gamma = \\int_0^1\\frac{1-t^{z-1}}{1-t}\\,dt.\\]\n\nFor \\(0<t<1\\), the power is defined using the real logarithm of \\(t\\). The apparent singularity at \\(t=1\\) is removable.\n\nAnother representation on the same half-plane is\n\n\\[\\psi(z) = \\int_0^\\infty \\left( \\frac{e^{-t}}{t} - \\frac{e^{-zt}}{1-e^{-t}} \\right)\\,dt.\\]\n\nThe two terms must be integrated together: each separately has a divergent integral near zero, while their difference is integrable.\n\nThese representations support proofs of identities and inequalities. Analytic continuation extends the resulting identities beyond their initial domains when appropriate."
    },
    {
      "heading": "Special values and local expansions",
      "text": "Some basic values are\n\n\\[\\psi(1)=-\\gamma, \\qquad \\psi\\!\\left(\\frac12\\right)=-\\gamma-2\\log 2,\\]\n\n\\[\\psi\\!\\left(\\frac13\\right) = -\\gamma-\\frac{\\pi}{2\\sqrt3}-\\frac32\\log 3,\\]\n\nand\n\n\\[\\psi\\!\\left(\\frac14\\right) = -\\gamma-\\frac{\\pi}{2}-3\\log 2.\\]\n\nHere and throughout, \\(\\log\\) denotes the natural logarithm for positive real arguments.\n\nAround \\(z=0\\), a convergent Taylor expansion is\n\n\\[\\psi(1+z) = -\\gamma+ \\sum_{n=1}^{\\infty} (-1)^{n+1}\\zeta(n+1)z^n, \\qquad |z|<1,\\]\n\nwhere \\(\\zeta\\) is the Riemann zeta function. In particular,\n\n\\[\\psi(1+z) = -\\gamma+\\frac{\\pi^2}{6}z-\\zeta(3)z^2 +\\frac{\\pi^4}{90}z^3-\\cdots.\\]"
    },
    {
      "heading": "Derivatives and real-variable behavior",
      "text": "The higher derivatives of \\(\\psi\\) are the polygamma functions:\n\n\\[\\psi^{(m)}(z) = \\frac{d^{m+1}}{dz^{m+1}}\\log\\Gamma(z), \\qquad m\\geq 0,\\]\n\nwith \\(\\psi^{(0)}=\\psi\\). The first derivative \\(\\psi'(z)\\) is called the trigamma function.\n\nFor \\(m\\geq1\\),\n\n\\[\\psi^{(m)}(z) = (-1)^{m+1}m! \\sum_{n=0}^{\\infty}\\frac{1}{(z+n)^{m+1}},\\]\n\naway from the poles.\n\nFor positive real \\(x\\),\n\n\\[\\psi'(x)>0, \\qquad \\psi''(x)<0.\\]\n\nConsequently, \\(\\psi\\) is strictly increasing and strictly concave on \\((0,\\infty)\\). Its endpoint behavior is\n\n\\[\\lim_{x\\to0^+}\\psi(x)=-\\infty, \\qquad \\lim_{x\\to\\infty}\\psi(x)=+\\infty.\\]\n\nIt therefore has exactly one positive zero:\n\n\\[x\\approx1.461632144968362.\\]\n\nBecause \\(\\Gamma'(x)=\\Gamma(x)\\psi(x)\\) and \\(\\Gamma(x)>0\\) for \\(x>0\\), this point is also the unique minimum of the gamma function on the positive real axis.\n\nThe trigamma series is positive at every real nonpole, so \\(\\psi\\) is also strictly increasing on each interval between consecutive negative integer poles. Its one-sided limits imply exactly one real zero in each interval\n\n\\[(-n,-n+1),\\qquad n=1,2,\\ldots.\\]"
    },
    {
      "heading": "Asymptotic behavior and numerical evaluation",
      "text": "For large \\(z\\), the digamma function has the asymptotic expansion\n\n\\[\\psi(z) \\sim \\log z-\\frac{1}{2z} -\\sum_{k=1}^{\\infty}\\frac{B_{2k}}{2k\\,z^{2k}},\\]\n\nwhere \\(B_{2k}\\) are Bernoulli numbers. The first terms are\n\n\\[\\psi(z) \\sim \\log z-\\frac{1}{2z} -\\frac{1}{12z^2} +\\frac{1}{120z^4} -\\frac{1}{252z^6} +\\cdots.\\]\n\nThis expansion applies as \\(|z|\\to\\infty\\) in sectors bounded away from the negative real axis, using the principal branch of \\(\\log z\\). It is generally not a convergent series; its usefulness depends on truncating it appropriately.\n\nA standard numerical evaluation strategy combines argument transformations with this expansion:\n\n- Use recurrence to shift the argument into a region with sufficiently large positive real part.\n- Evaluate an asymptotic approximation there.\n- Undo the shift using the corresponding finite reciprocal sum.\n- Use reflection when appropriate for arguments with negative real part.\n\nNear a pole, the singular term \\(-1/(z+n)\\) dominates. Near a zero, cancellation can reduce relative accuracy, so robust implementations may use local expansions or specialized approximations. Directly evaluating \\(\\Gamma'(z)\\) and \\(\\Gamma(z)\\) separately is usually less suitable because the gamma function can overflow even when their ratio is moderate."
    },
    {
      "heading": "Applications",
      "text": "Summation and integration\n\nThe recurrence gives the finite-sum identity\n\n\\[\\sum_{k=0}^{N-1}\\frac{1}{k+a} = \\psi(a+N)-\\psi(a).\\]\n\nA related convergent infinite sum is\n\n\\[\\sum_{n=0}^{\\infty} \\frac{1}{(n+a)(n+b)} = \\frac{\\psi(b)-\\psi(a)}{b-a},\\]\n\nfor distinct \\(a,b\\) away from the nonpositive integers.\n\nDifferentiating integrals containing gamma-function factors also produces digamma values. For example, differentiating the gamma integral with respect to its parameter gives\n\n\\[\\int_0^\\infty t^{a-1}e^{-t}\\log t\\,dt = \\Gamma(a)\\psi(a), \\qquad \\operatorname{Re}a>0.\\]\n\nProbability and statistical inference\n\nIf \\(X\\) has a gamma distribution with shape \\(\\alpha>0\\) and rate \\(\\beta>0\\), then its logarithmic expectation is\n\n\\[\\mathbb E[\\log X]=\\psi(\\alpha)-\\log\\beta.\\]\n\nIts log variance is\n\n\\[\\operatorname{Var}(\\log X)=\\psi'(\\alpha).\\]\n\nFor a beta distribution with parameters \\(\\alpha,\\beta>0\\),\n\n\\[\\mathbb E[\\log X] = \\psi(\\alpha)-\\psi(\\alpha+\\beta),\\]\n\n\\[\\mathbb E[\\log(1-X)] = \\psi(\\beta)-\\psi(\\alpha+\\beta).\\]\n\nMore generally, for a Dirichlet distribution with parameter vector \\((\\alpha_1,\\ldots,\\alpha_K)\\),\n\n\\[\\mathbb E[\\log X_i] = \\psi(\\alpha_i) - \\psi\\!\\left(\\sum_{j=1}^{K}\\alpha_j\\right).\\]\n\nThese expectations appear in Bayesian inference and variational inference.\n\nThe digamma function also enters maximum likelihood estimation. For independent positive observations from a gamma distribution with unknown shape and rate, eliminating the rate parameter gives the shape equation\n\n\\[\\log\\alpha-\\psi(\\alpha) = \\log\\bar x-\\frac1n\\sum_{i=1}^{n}\\log x_i.\\]\n\nThis equation generally requires numerical solution. Its derivative,\n\n\\[\\frac1\\alpha-\\psi'(\\alpha),\\]\n\nallows the use of Newton's method. Trigamma and higher polygamma functions likewise appear in likelihood derivatives and information matrices."
    }
  ],
  "links": [
    "derivative",
    "gamma-function",
    "mathematical-analysis",
    "complex-number",
    "euler-mascheroni-constant",
    "recurrence-relation",
    "harmonic-number",
    "infinite-series",
    "integral",
    "analytic-continuation",
    "natural-logarithm",
    "taylor-series",
    "riemann-zeta-function",
    "asymptotic-expansion",
    "numerical-analysis",
    "expected-value",
    "beta-distribution",
    "dirichlet-distribution",
    "bayesian-inference",
    "variational-inference",
    "maximum-likelihood-estimation",
    "newtons-method"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}