{
  "id": "marginal-distribution",
  "title": "Marginal Distribution",
  "lang": "en",
  "source_lang": "en",
  "summary": "A marginal distribution describes selected variables within a joint probability distribution, obtained by summing or integrating over the variables not retained.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "Marginal probability distribution",
    "Marginal law"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/marginal-distribution/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/marginal-distribution/",
      "json": "https://aiwiki.page/zh/marginal-distribution.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A marginal distribution is the probability distribution of one variable, or a selected group of variables, considered within a larger collection of random variables. It is obtained from their joint distribution by accounting for all possible values of the variables not retained. This operation, called marginalization, uses summation for discrete variables and integration for variables with a joint density. Unlike conditioning, marginalization does not fix the omitted variables at particular values."
    },
    {
      "heading": "Definition",
      "text": "For random variables \\(X\\) and \\(Y\\), their joint distribution specifies probabilities involving both variables. The marginal distribution of \\(X\\) specifies probabilities involving \\(X\\) alone:\n\n\\[P_X(A)=P(X\\in A)=P(X\\in A,\\;Y\\in\\mathcal Y),\\]\n\nwhere \\(A\\) is a measurable set of possible values of \\(X\\), and \\(\\mathcal Y\\) is the entire state space of \\(Y\\).\n\nThe term marginal reflects the layout of a two-way probability table: row and column totals can be written in its margins. These totals give the separate distributions of the row and column variables.\n\nA marginal need not describe just one variable. For a random vector \\((X_1,\\ldots,X_n)\\), the joint distribution of any selected subvector is a marginal of the full distribution. For example, the distribution of \\((X_1,X_3)\\) is a two-dimensional marginal of the distribution of \\((X_1,X_2,X_3)\\)."
    },
    {
      "heading": "Discrete variables",
      "text": "If \\(X\\) and \\(Y\\) are discrete, their joint probability mass function is\n\n\\[p_{X,Y}(x,y)=P(X=x,\\;Y=y).\\]\n\nThe marginal mass functions are\n\n\\[p_X(x)=\\sum_y p_{X,Y}(x,y), \\qquad p_Y(y)=\\sum_x p_{X,Y}(x,y).\\]\n\nEach sum runs over all possible values of the variable being eliminated. No assumption of statistical independence is required.\n\nFor example, consider the joint distribution:\n\n | \\(Y=0\\) | \\(Y=1\\) | Marginal of \\(X\\)\n\\(X=0\\) | \\(0.10\\) | \\(0.20\\) | \\(0.30\\)\n\\(X=1\\) | \\(0.30\\) | \\(0.40\\) | \\(0.70\\)\nMarginal of \\(Y\\) | \\(0.40\\) | \\(0.60\\) | \\(1.00\\)\n\nThus,\n\n\\[P(X=1)=0.30+0.40=0.70,\\]\n\nand\n\n\\[P(Y=0)=0.10+0.30=0.40.\\]\n\nThe marginal distributions retain the probabilities for each variable separately but not the full pattern of association between them. In this example, the variables are not independent, since\n\n\\[P(X=0,Y=0)=0.10 \\ne P(X=0)P(Y=0)=0.12.\\]"
    },
    {
      "heading": "Continuous variables",
      "text": "If \\((X,Y)\\) has a joint probability density function \\(f_{X,Y}\\), its marginal densities are\n\n\\[f_X(x)=\\int_{-\\infty}^{\\infty}f_{X,Y}(x,y)\\,dy,\\]\n\n\\[f_Y(y)=\\int_{-\\infty}^{\\infty}f_{X,Y}(x,y)\\,dx.\\]\n\nThese equations determine densities up to changes on sets of Lebesgue measure zero. The integration limits may be restricted to the region where the joint density is nonzero.\n\nFor example, suppose\n\n\\[f_{X,Y}(x,y)= \\begin{cases} 2, & 0<x<y<1,\\\\ 0, & \\text{otherwise}. \\end{cases}\\]\n\nThe marginal density of \\(X\\) is\n\n\\[f_X(x)=\\int_x^1 2\\,dy=2(1-x), \\qquad 0<x<1,\\]\n\nand the marginal density of \\(Y\\) is\n\n\\[f_Y(y)=\\int_0^y 2\\,dx=2y, \\qquad 0<y<1.\\]\n\nBoth densities are zero outside these intervals. Each integrates to one, although neither is constant on \\((0,1)\\), despite the joint density being constant over its triangular support.\n\nMarginalizing a density is not the same as evaluating it at a fixed value of another variable. The function \\(f_{X,Y}(x,y_0)\\) is generally neither a normalized marginal density nor a normalized conditional density."
    },
    {
      "heading": "Distribution functions and general formulation",
      "text": "Marginal distributions exist even when no joint density exists. For real-valued variables, let the joint cumulative distribution function be\n\n\\[F_{X,Y}(x,y)=P(X\\le x,\\;Y\\le y).\\]\n\nThen\n\n\\[F_X(x)=\\lim_{y\\to+\\infty}F_{X,Y}(x,y), \\qquad F_Y(y)=\\lim_{x\\to+\\infty}F_{X,Y}(x,y).\\]\n\nThis formulation applies to discrete, continuous, mixed, and singular distributions.\n\nIn measure-theoretic terms, suppose the joint distribution is a probability measure \\(\\mu\\) on a product of measurable spaces \\(\\mathcal X\\times\\mathcal Y\\). The marginal on \\(\\mathcal X\\) is\n\n\\[\\mu_X(A)=\\mu(A\\times\\mathcal Y).\\]\n\nEquivalently, it is the measure induced by the coordinate projection\n\n\\[\\pi_X(x,y)=x: \\qquad \\mu_X(A)=\\mu\\bigl(\\pi_X^{-1}(A)\\bigr).\\]\n\nThis definition makes marginalization a special case of obtaining the distribution of a measurable function of a random element.\n\nFor higher-dimensional distributions, marginalizing in stages gives the same result as removing all unwanted coordinates at once. For example, eliminating \\(Z\\) and then \\(Y\\) from \\((X,Y,Z)\\) gives the same marginal of \\(X\\) as eliminating \\((Y,Z)\\) together. For nonnegative mass functions and densities, the relevant sums and integrals can be reordered."
    },
    {
      "heading": "Marginal versus conditional distributions",
      "text": "A marginal distribution describes a variable without restricting the values of the other variables. A conditional distribution describes it under a specified condition.\n\nFor discrete variables, conditional probability gives\n\n\\[p_{X\\mid Y}(x\\mid y) = \\frac{p_{X,Y}(x,y)}{p_Y(y)}, \\qquad p_Y(y)>0.\\]\n\nBy contrast,\n\n\\[p_X(x)=\\sum_y p_{X,Y}(x,y) =\\sum_y p_{X\\mid Y}(x\\mid y)p_Y(y).\\]\n\nThus, a marginal distribution is a probability-weighted average of conditional distributions, not usually their equally weighted average.\n\nWhen a joint density exists, the analogous formula is\n\n\\[f_X(x)=\\int f_{X\\mid Y}(x\\mid y)f_Y(y)\\,dy,\\]\n\nwhere the conditional density is defined for relevant values of \\(y\\) with \\(f_Y(y)>0\\).\n\nIn the discrete table above,\n\n\\[P(X=1\\mid Y=0)=\\frac{0.30}{0.40}=0.75,\\]\n\nwhereas the marginal probability is \\(P(X=1)=0.70\\).\n\nIf \\(X\\) and \\(Y\\) are independent, conditioning on one does not change the distribution of the other, apart from qualifications concerning conditioning on null sets. Conversely, if the conditional distribution of \\(X\\) equals its marginal distribution for \\(P_Y\\)-almost every \\(y\\), then the variables are independent."
    },
    {
      "heading": "What marginals do and do not determine",
      "text": "A joint distribution determines its marginals uniquely. Marginal distributions alone generally do not determine the joint distribution.\n\nFor example, let \\(U\\) have a uniform distribution on \\([0,1]\\). Each of the following constructions gives \\(X\\) and \\(Y\\) the same uniform marginals:\n\n- \\(X=U\\) and \\(Y=U\\);\n- \\(X=U\\) and \\(Y=1-U\\);\n- \\(X=U\\) and \\(Y=V\\), where \\(V\\) is an independent uniform variable.\n\nNevertheless, the first construction has correlation \\(1\\), the second has correlation \\(-1\\), and the third has independent coordinates.\n\nIndependence supplies one particular joint distribution compatible with given marginals:\n\n\\[P(X\\in A,\\;Y\\in B)=P_X(A)P_Y(B).\\]\n\nFor variables with a joint density, this becomes\n\n\\[f_{X,Y}(x,y)=f_X(x)f_Y(y)\\]\n\nalmost everywhere. Multiplying marginal densities is therefore justified only when independence is assumed or established.\n\nEven complete knowledge of all one-dimensional marginals does not generally determine a multivariate distribution. Higher-order dependence may remain unspecified."
    },
    {
      "heading": "Expectations and multivariate normal distributions",
      "text": "Any expectation involving only \\(X\\) can be calculated from its marginal distribution. For an integrable function \\(g\\),\n\n\\[\\mathbb E[g(X)] = \\int g(x)\\,P_X(dx).\\]\n\nWhen a joint density exists, this is equivalently\n\n\\[\\mathbb E[g(X)] = \\int\\!\\!\\int g(x)f_{X,Y}(x,y)\\,dy\\,dx.\\]\n\nConsequently, the mean and variance of \\(X\\) depend only on its marginal distribution. In contrast, covariance between \\(X\\) and \\(Y\\) generally requires information about their joint distribution.\n\nAn important closed-form example is the multivariate normal distribution. If\n\n\\[\\begin{pmatrix}X\\\\Y\\end{pmatrix} \\sim \\mathcal N\\left( \\begin{pmatrix}\\mu_X\\\\\\mu_Y\\end{pmatrix}, \\begin{pmatrix} \\Sigma_{XX}&\\Sigma_{XY}\\\\ \\Sigma_{YX}&\\Sigma_{YY} \\end{pmatrix} \\right),\\]\n\nthen\n\n\\[X\\sim\\mathcal N(\\mu_X,\\Sigma_{XX}), \\qquad Y\\sim\\mathcal N(\\mu_Y,\\Sigma_{YY}).\\]\n\nHere \\(X\\) and \\(Y\\) may themselves be vectors. Their marginal parameters are obtained by selecting the corresponding mean entries and covariance matrix blocks. The cross-covariance blocks affect their dependence and conditional distributions, but not these marginals."
    },
    {
      "heading": "Applications and computation",
      "text": "In Bayesian inference, marginalization removes parameters or latent variables not currently of interest. If \\(\\theta\\) is a target parameter, \\(z\\) represents other unknown quantities, and \\(D\\) denotes observed data, the marginal posterior distribution is\n\n\\[p(\\theta\\mid D)=\\int p(\\theta,z\\mid D)\\,dz.\\]\n\nThis preserves uncertainty about \\(z\\) by averaging over its posterior distribution. Substituting a single estimate of \\(z\\) generally gives a different result.\n\nThe marginal likelihood similarly integrates a likelihood over a prior distribution:\n\n\\[p(D)=\\int p(D\\mid\\theta)p(\\theta)\\,d\\theta.\\]\n\nIn probabilistic graphical models, computing marginal probabilities is a central inference task. Factorization and conditional independence can make some calculations substantially more efficient.\n\nAlthough the mathematical operation is straightforward, exact marginalization can be computationally expensive. Direct summation over many discrete variables may require exponentially many terms, while high-dimensional integration can encounter the curse of dimensionality. Practical approaches include numerical integration, exact elimination methods, Monte Carlo methods, Markov chain Monte Carlo, and variational inference.\n\nMarginalization should also be distinguished from optimization. Integrating over an unwanted parameter accounts for its possible values with probability weights; maximizing over it selects a value giving the largest objective. The resulting functions generally answer different statistical questions."
    }
  ],
  "links": [
    "probability-distribution",
    "random-variable",
    "joint-probability-distribution",
    "probability-mass-function",
    "statistical-independence",
    "probability-density-function",
    "lebesgue-measure",
    "cumulative-distribution-function",
    "measure-theory",
    "measurable-space",
    "measurable-function",
    "conditional-probability",
    "uniform-distribution",
    "correlation",
    "expected-value",
    "variance",
    "covariance",
    "multivariate-normal-distribution",
    "covariance-matrix",
    "bayesian-inference",
    "posterior-distribution",
    "marginal-likelihood",
    "probabilistic-graphical-model",
    "conditional-independence",
    "curse-of-dimensionality",
    "monte-carlo-method",
    "markov-chain-monte-carlo",
    "variational-inference"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}