{
  "id": "quantile-function",
  "title": "Quantile Function",
  "lang": "en",
  "source_lang": "en",
  "summary": "A quantile function maps cumulative probabilities to distribution values, providing a generalized inverse of a cumulative distribution function.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "Inverse distribution function",
    "Generalized inverse distribution function",
    "Percent-point function"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/quantile-function/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/quantile-function/",
      "json": "https://aiwiki.page/zh/quantile-function.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A quantile function describes a probability distribution by assigning a value to each cumulative probability level. If \\(F\\) is the distribution’s cumulative distribution function (CDF), its quantile function is conventionally defined by\n\n\\[Q(p)=\\inf\\{x\\in\\mathbb{R}:F(x)\\ge p\\}, \\qquad 0<p<1.\\]\n\nThus, \\(Q(p)\\) is the smallest threshold at which the cumulative probability reaches or exceeds \\(p\\). It gives a consistent choice of quantile even when the distribution is discrete or its CDF has flat regions. Quantile functions are used in statistical description, simulation, distribution comparison, and the analysis of tail behavior."
    },
    {
      "heading": "Definition and interpretation",
      "text": "For a real-valued random variable \\(X\\),\n\n\\[F(x)=\\Pr(X\\le x).\\]\n\nThe CDF maps a threshold \\(x\\) to a cumulative probability; the quantile function reverses this direction, mapping a probability level \\(p\\) to a threshold.\n\nFor example:\n\n- \\(Q(0.5)\\) is a median, specifically the lower median under the stated convention.\n- \\(Q(0.25)\\) and \\(Q(0.75)\\) are the lower and upper quartiles.\n- \\(Q(0.95)\\) is the 95th percentile.\n\nWriting\n\n\\[F(x-)=\\lim_{t\\uparrow x}F(t),\\]\n\nthe value \\(q=Q(p)\\) satisfies\n\n\\[F(q-)\\le p\\le F(q).\\]\n\nEquivalently,\n\n\\[\\Pr(X<q)\\le p \\quad\\text{and}\\quad \\Pr(X\\le q)\\ge p.\\]\n\nThese inequalities are more general than the equation \\(F(q)=p\\), which may have no solution for a discrete distribution.\n\nMore broadly, any value satisfying these inequalities may be called a \\(p\\)-quantile. Such a value need not be unique. The conventional quantile function selects the smallest qualifying value.\n\nEndpoint conventions\n\nThe definition is most straightforward on \\(0<p<1\\), where \\(Q(p)\\) is finite for a real-valued random variable. A common extension is\n\n\\[Q(0)=\\lim_{p\\downarrow0}Q(p), \\qquad Q(1)=\\lim_{p\\uparrow1}Q(p).\\]\n\nThese are the essential lower and upper endpoints of the distribution and may be infinite.\n\nEndpoint conventions require explicit attention. Substituting \\(p=0\\) directly into the infimum definition would give \\(-\\infty\\) for every CDF, rather than the lower endpoint of a bounded distribution."
    },
    {
      "heading": "Generalized inversion",
      "text": "When \\(F\\) is continuous and strictly increasing over the range relevant to probabilities in \\((0,1)\\), the quantile function is an ordinary inverse function:\n\n\\[F(Q(p))=p.\\]\n\nIn general, a CDF need not be invertible:\n\n- A jump in \\(F\\) represents positive probability concentrated at one value.\n- A constant interval in \\(F\\) represents an interval containing no probability mass.\n- A bounded distribution has constant CDF tails outside its support.\n\nThe infimum definition handles all these cases. Its fundamental inversion property is\n\n\\[Q(p)\\le x \\quad\\Longleftrightarrow\\quad p\\le F(x), \\qquad 0<p<1.\\]\n\nThis equivalence follows from monotonicity and the right-continuity of the CDF.\n\nThe quantile function is a nondecreasing function and is left-continuous on \\((0,1)\\). Other generalized-inverse conventions can differ at particular probability levels, so the defining inequality matters when distributions have gaps or atoms.\n\nA jump of \\(F\\) at \\(x\\) produces a constant segment of \\(Q\\):\n\n\\[F(x-)<p\\le F(x) \\quad\\Longrightarrow\\quad Q(p)=x.\\]\n\nConversely, a gap in the distribution’s support can produce a jump in \\(Q\\). These features distinguish quantile functions from smooth inverse curves."
    },
    {
      "heading": "Examples",
      "text": "Uniform distribution\n\nFor the uniform distribution on \\([a,b]\\), with \\(a<b\\),\n\n\\[Q(p)=a+(b-a)p.\\]\n\nEqual increments in cumulative probability correspond to equal increments in value.\n\nExponential distribution\n\nFor an exponential distribution with rate \\(\\lambda>0\\),\n\n\\[F(x)=1-e^{-\\lambda x},\\qquad x\\ge0.\\]\n\nSolving for \\(x\\) gives\n\n\\[Q(p)=-\\frac{\\ln(1-p)}{\\lambda}.\\]\n\nThe quantile increases without bound as \\(p\\) approaches \\(1\\).\n\nNormal distribution\n\nIf \\(X\\) has a normal distribution with mean \\(\\mu\\) and standard deviation \\(\\sigma>0\\), then\n\n\\[Q(p)=\\mu+\\sigma\\Phi^{-1}(p),\\]\n\nwhere \\(\\Phi\\) is the standard normal CDF.\n\nThe standard normal quantile function has no elementary closed form and is usually evaluated using numerical approximations or specialized library routines.\n\nDiscrete distribution\n\nSuppose\n\n\\[\\Pr(X=0)=0.2,\\qquad \\Pr(X=1)=0.5,\\qquad \\Pr(X=3)=0.3.\\]\n\nThen\n\n\\[Q(p)= \\begin{cases} 0,&0<p\\le0.2,\\\\ 1,&0.2<p\\le0.7,\\\\ 3,&0.7<p<1. \\end{cases}\\]\n\nIn particular, \\(Q(0.7)=1\\), not \\(3\\). At this probability level, every value in \\([1,3]\\) satisfies the broader quantile inequalities, but the generalized-inverse convention selects \\(1\\)."
    },
    {
      "heading": "Analytical properties",
      "text": "Derivatives and density\n\nSuppose \\(F\\) has a continuous, positive probability density \\(f\\) near \\(Q(p)\\). Differentiating \\(F(Q(p))=p\\) yields\n\n\\[Q'(p)=\\frac{1}{f(Q(p))}.\\]\n\nThe derivative \\(Q'(p)\\) is sometimes called the quantile density or sparsity function.\n\nWhere the density is small, a small change in probability level can correspond to a large change in the quantile. This helps explain the sensitivity of extreme quantiles in many distributions. The derivative formula does not apply at atoms, at quantile jumps, or where the required smoothness and positivity fail.\n\nIf \\(f\\) is also differentiable, then\n\n\\[Q''(p) = -\\frac{f'(Q(p))}{f(Q(p))^3}.\\]\n\nLocation and scale\n\nFor \\(Y=a+bX\\), with \\(b>0\\),\n\n\\[Q_Y(p)=a+bQ_X(p).\\]\n\nThus, positive location-scale transformations preserve the ordering of quantiles.\n\nMore generally, if \\(g\\) is continuous and strictly increasing,\n\n\\[Q_{g(X)}(p)=g(Q_X(p)).\\]\n\nFor a continuous, strictly decreasing transformation, the probability order is reversed. For distributions with jumps, a formula involving \\(Q_X(1-p)\\) requires care with one-sided limits and quantile conventions.\n\nExpectations and moments\n\nQuantile functions also encode expectations. If \\(X\\) is integrable,\n\n\\[\\operatorname{E}[X]=\\int_0^1Q(p)\\,dp.\\]\n\nMore generally, for a measurable function \\(h\\),\n\n\\[\\operatorname{E}[h(X)] = \\int_0^1 h(Q(p))\\,dp\\]\n\nwhenever the expectation is well-defined. These expressions can be interpreted as Lebesgue integrals.\n\nIf the second moment is finite,\n\n\\[\\operatorname{Var}(X) = \\int_0^1Q(p)^2\\,dp - \\left(\\int_0^1Q(p)\\,dp\\right)^2.\\]\n\nA quantile function therefore determines not only individual percentiles but the entire distribution and all moments that exist."
    },
    {
      "heading": "Random-variable generation",
      "text": "Quantile functions provide the basis of inverse transform sampling. If\n\n\\[U\\sim\\operatorname{Uniform}(0,1),\\]\n\nthen\n\n\\[X=Q(U)\\]\n\nhas CDF \\(F\\). Indeed,\n\n\\[\\Pr(Q(U)\\le x) = \\Pr(U\\le F(x)) = F(x).\\]\n\nUnlike ordinary inversion, this result remains valid for discrete and mixed distributions.\n\nFor example, an exponential random variable can be generated as\n\n\\[X=-\\frac{\\ln(1-U)}{\\lambda}.\\]\n\nThis construction is widely used in Monte Carlo methods. Its computational efficiency depends on how readily the quantile function can be evaluated; other simulation methods can be preferable for particular distributions.\n\nThe reverse statement needs an additional assumption. If \\(F\\) is continuous, then \\(F(X)\\) is uniformly distributed on \\((0,1)\\), a result called the probability integral transform. For a discontinuous CDF, \\(F(X)\\) is generally not uniform."
    },
    {
      "heading": "Empirical quantile functions",
      "text": "Given observations \\(x_1,\\ldots,x_n\\), the empirical distribution function is\n\n\\[F_n(x)=\\frac{1}{n}\\sum_{i=1}^{n}\\mathbf{1}_{\\{x_i\\le x\\}}.\\]\n\nLet the ordered observations be\n\n\\[x_{(1)}\\le x_{(2)}\\le\\cdots\\le x_{(n)}.\\]\n\nThe generalized inverse of \\(F_n\\) is\n\n\\[Q_n(p)=x_{(\\lceil np\\rceil)}, \\qquad 0<p<1.\\]\n\nIt is a step function taking observed sample values.\n\nStatistical software also uses other sample-quantile definitions, often involving interpolation between adjacent ordered observations. Such definitions are not necessarily the exact generalized inverse of \\(F_n\\). Consequently, software packages can return different quartiles or percentiles for the same small sample.\n\nSampling uncertainty\n\nUnder independent, identically distributed sampling, if \\(F\\) is differentiable near \\(q=Q(p)\\) with a continuous density satisfying \\(f(q)>0\\), then\n\n\\[\\sqrt n\\bigl(Q_n(p)-Q(p)\\bigr) \\xrightarrow{d} N\\!\\left(0,\\frac{p(1-p)}{f(Q(p))^2}\\right).\\]\n\nThe corresponding approximate standard error is\n\n\\[\\sqrt{\\frac{p(1-p)}{n\\,f(Q(p))^2}}.\\]\n\nThis result concerns a fixed probability level \\(p\\) as the sample size increases. It does not automatically apply to increasingly extreme quantiles whose probability levels approach \\(0\\) or \\(1\\) with sample size. Distributions with atoms or zero density at the target quantile also require different analysis."
    },
    {
      "heading": "Quantiles as optimization solutions",
      "text": "Quantiles can be characterized through a loss function. For \\(0<p<1\\), define the check loss, or pinball loss, by\n\n\\[\\rho_p(u)=u\\bigl(p-\\mathbf{1}_{\\{u<0\\}}\\bigr).\\]\n\nEquivalently,\n\n\\[\\rho_p(u)= \\begin{cases} pu,&u\\ge0,\\\\ (1-p)(-u),&u<0. \\end{cases}\\]\n\nFor an integrable random variable \\(X\\), the minimizers of\n\n\\[\\operatorname{E}[\\rho_p(X-a)]\\]\n\nover real \\(a\\) are exactly the values satisfying\n\n\\[F(a-)\\le p\\le F(a).\\]\n\nThe conventional value \\(Q(p)\\) is the smallest minimizer.\n\nAt \\(p=0.5\\), this loss is proportional to absolute error, explaining why medians minimize expected absolute deviation. Other probability levels impose unequal penalties on overprediction and underprediction.\n\nThis characterization underlies quantile regression, which models conditional quantiles rather than conditional means."
    },
    {
      "heading": "Applications and computation",
      "text": "Quantile functions support several kinds of distributional analysis:\n\n- Distribution comparison: A quantile–quantile plot compares quantiles from two distributions. Approximate linearity can indicate a location-scale relationship.\n- Tail summaries: High or low quantiles describe thresholds exceeded with specified probabilities. A quantile alone does not describe the magnitude of observations beyond that threshold.\n- Prediction: Conditional quantiles can define prediction intervals when their probability coverage is appropriately established.\n- Sensitivity analysis: The quantile derivative measures how rapidly value thresholds change with cumulative probability.\n\nWhen no closed form is available, continuous quantiles may be computed by solving\n\n\\[F(x)-p=0.\\]\n\nBracketed root-finding methods are reliable when a suitable bracket is available. Newton’s method uses the update\n\n\\[x_{k+1} = x_k-\\frac{F(x_k)-p}{f(x_k)},\\]\n\nbut may be unstable when the density is very small or the initial approximation is poor.\n\nFor discrete distributions, solving \\(F(x)=p\\) is generally inappropriate: the equation may have no solution. Computation instead searches for the smallest value whose cumulative probability is at least \\(p\\).\n\nExtreme-tail calculations require particular care with floating-point arithmetic. Near \\(p=1\\), subtracting \\(p\\) from \\(1\\) can lose precision, and CDF values can round to \\(1\\). Numerical libraries may therefore provide inverse survival functions or accept logarithmic probabilities. These interfaces can preserve information that would otherwise be lost before quantile evaluation begins."
    }
  ],
  "links": [
    "probability-distribution",
    "cumulative-distribution-function",
    "quantile",
    "random-variable",
    "median",
    "inverse-function",
    "monotonic-function",
    "uniform-distribution",
    "exponential-distribution",
    "normal-distribution",
    "probability-density-function",
    "derivative",
    "expected-value",
    "lebesgue-integral",
    "inverse-transform-sampling",
    "monte-carlo-method",
    "empirical-distribution-function",
    "interpolation",
    "standard-error",
    "loss-function",
    "prediction-interval",
    "newtons-method",
    "floating-point-arithmetic"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}