Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • Linguistic Understanding

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • For AIs
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
Variance
  • See Also
    • StandardDeviation
    • Covariance
    • Correlation
    • TrimmedVariance
    • WinsorizedVariance
    • BiweightMidvariance
    • QnDispersion
    • SnDispersion
    • Mean
    • MeanDeviation
    • MedianDeviation
    • Kurtosis
    • CentralMoment
    • Expectation
  • Related Guides
    • Descriptive Statistics
    • Statistical Data Analysis
    • GPU Computing
    • Math & Counting Operations on Lists
    • Statistical Moments and Generating Functions
    • Numerical Data
    • Scientific Data Analysis
    • Precollege Education
    • Time Series Processing
    • Image Processing & Analysis
    • Finite Mathematics
    • Probability & Statistics
    • GPU Computing with Apple
    • GPU Computing with NVIDIA
    • Date & Time
    • Event Series Processing
    • Signal Visualization & Analysis
    • Audio Processing
    • Symbolic Vectors, Matrices and Arrays
  • Tech Notes
    • Basic Statistics
    • Descriptive Statistics
    • Discrete Distributions
    • Continuous Distributions
    • See Also
      • StandardDeviation
      • Covariance
      • Correlation
      • TrimmedVariance
      • WinsorizedVariance
      • BiweightMidvariance
      • QnDispersion
      • SnDispersion
      • Mean
      • MeanDeviation
      • MedianDeviation
      • Kurtosis
      • CentralMoment
      • Expectation
    • Related Guides
      • Descriptive Statistics
      • Statistical Data Analysis
      • GPU Computing
      • Math & Counting Operations on Lists
      • Statistical Moments and Generating Functions
      • Numerical Data
      • Scientific Data Analysis
      • Precollege Education
      • Time Series Processing
      • Image Processing & Analysis
      • Finite Mathematics
      • Probability & Statistics
      • GPU Computing with Apple
      • GPU Computing with NVIDIA
      • Date & Time
      • Event Series Processing
      • Signal Visualization & Analysis
      • Audio Processing
      • Symbolic Vectors, Matrices and Arrays
    • Tech Notes
      • Basic Statistics
      • Descriptive Statistics
      • Discrete Distributions
      • Continuous Distributions

Variance[data]

gives the variance estimate of the elements in data.

Variance[dist]

gives the variance of the distribution dist.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Basic Uses  
Array Data  
Image and Audio Data  
Date and Time  
Distributions and Processes  
Applications  
Properties & Relations  
Possible Issues  
Neat Examples  
See Also
Tech Notes
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • StandardDeviation
    • Covariance
    • Correlation
    • TrimmedVariance
    • WinsorizedVariance
    • BiweightMidvariance
    • QnDispersion
    • SnDispersion
    • Mean
    • MeanDeviation
    • MedianDeviation
    • Kurtosis
    • CentralMoment
    • Expectation
  • Related Guides
    • Descriptive Statistics
    • Statistical Data Analysis
    • GPU Computing
    • Math & Counting Operations on Lists
    • Statistical Moments and Generating Functions
    • Numerical Data
    • Scientific Data Analysis
    • Precollege Education
    • Time Series Processing
    • Image Processing & Analysis
    • Finite Mathematics
    • Probability & Statistics
    • GPU Computing with Apple
    • GPU Computing with NVIDIA
    • Date & Time
    • Event Series Processing
    • Signal Visualization & Analysis
    • Audio Processing
    • Symbolic Vectors, Matrices and Arrays
  • Tech Notes
    • Basic Statistics
    • Descriptive Statistics
    • Discrete Distributions
    • Continuous Distributions
    • See Also
      • StandardDeviation
      • Covariance
      • Correlation
      • TrimmedVariance
      • WinsorizedVariance
      • BiweightMidvariance
      • QnDispersion
      • SnDispersion
      • Mean
      • MeanDeviation
      • MedianDeviation
      • Kurtosis
      • CentralMoment
      • Expectation
    • Related Guides
      • Descriptive Statistics
      • Statistical Data Analysis
      • GPU Computing
      • Math & Counting Operations on Lists
      • Statistical Moments and Generating Functions
      • Numerical Data
      • Scientific Data Analysis
      • Precollege Education
      • Time Series Processing
      • Image Processing & Analysis
      • Finite Mathematics
      • Probability & Statistics
      • GPU Computing with Apple
      • GPU Computing with NVIDIA
      • Date & Time
      • Event Series Processing
      • Signal Visualization & Analysis
      • Audio Processing
      • Symbolic Vectors, Matrices and Arrays
    • Tech Notes
      • Basic Statistics
      • Descriptive Statistics
      • Discrete Distributions
      • Continuous Distributions

Variance

Variance[data]

gives the variance estimate of the elements in data.

Variance[dist]

gives the variance of the distribution dist.

Details

  • Variance measures dispersion of data or distributions.
  • Variance[data] gives the unbiased estimate of variance.
  • For VectorQ data , the variance estimate is given by for reals and for complexes and =Mean[data].
  • For MatrixQ data, the variance estimate is computed for each column vector, with Variance[{{x1,y1,…},{x2,y2,…},…}] equivalent to {Variance[{x1,x2,…}],Variance[{y1,y2,…}]}. »
  • For ArrayQ data, variance is equivalent to ArrayReduce[Variance,data,1]. »
  • For a real weighted WeightedData[{x1,x2,…},{w1,w2,…}], the variance is given by . »
  • Variance handles both numerical and symbolic data.
  • The data can have the following additional forms and interpretations:
  • Associationthe values (the keys are ignored) »
    SparseArrayas an array, equivalent to Normal[data] »
    QuantityArrayquantities as an array »
    WeightedDataweighted variance, based on the underlying EmpiricalDistribution »
    EventDatabased on the underlying SurvivalDistribution »
    TimeSeries, TemporalData, …vector or array of values (the time stamps ignored) »
    Image,Image3DRGB channel's values or grayscale intensity value »
    Audioamplitude values of all channels »
    DateObject, TimeObjectlist of dates or list of time »
  • For a univariate distribution dist, the variance is given by σ2=Expectation[(x-μ)2,xdist] with μ=Mean[dist]. »
  • For a multivariate distribution dist, the variance is given by {σx2,σy2,…}=Expectation[{(x-μx)2,(y-μy)2,…},{x,y,…}dist]. »
  • For a random process proc, the variance function can be computed for slice distribution at time t, SliceDistribution[proc,t], as σ[t]2=Variance[SliceDistribution[proc,t]]. »

Examples

open all close all

Basic Examples  (4)

Variance of a list of numbers:

Wolfram Language code: Variance[{1.21, 3.4, 2, 4.66, 1.5, 5.61, 7.22}]

Variance of elements in each column:

Wolfram Language code: Variance[{{5.2, 7}, {5.3, 8}, {5.4, 9}}]

Variance of a list of dates:

Wolfram Language code: Variance[{Yesterday, Today, Tomorrow}]

Variance of a parametric distribution:

Wolfram Language code: Variance[LogNormalDistribution[0, 1]]

Scope  (22)

Basic Uses  (7)

Exact input yields exact output:

Wolfram Language code: Variance[{1, 2, 3, 4}]
Wolfram Language code: Variance[{π, E, 3}]//Together

Approximate input yields approximate output:

Wolfram Language code: Variance[{1., 2., 3., 4.}]
Wolfram Language code: Variance[N[{1, 2, 3, 4}, 30]]

Find the variance of WeightedData:

Wolfram Language code: Variance[WeightedData[{1, 2, 3}, {Subscript[w, 1], Subscript[w, 2], Subscript[w, 3]}]]
Wolfram Language code: data = {8, 3, 5, 4, 9, 0, 4, 2, 2, 3}; weights = {0.15, 0.09, 0.12, 0.10, 0.16, 0., 0.11, 0.08, 0.08, 0.09};
Wolfram Language code: Variance[WeightedData[data, weights]]

Find the variance of EventData:

Wolfram Language code: e = {1.0, 2.1, 3.2, 4.5, 5.7}; ci = {0, 0, 0, 1, 0};
Wolfram Language code: Variance[EventData[e, ci]]

Find the variance of TemporalData:

Wolfram Language code: s1 = {2, 1, 6, 5, 7, 4}; s2 = {4, 7, 5, 6, 1, 2}; t = {1, 2, 5, 10, 12, 15};
Wolfram Language code: td = TemporalData[{s1, s2}, {t}];
Wolfram Language code: Variance[td[10]]

Find the variance of a TimeSeries:

Wolfram Language code: v = {3, 8, 4, 11, 9, 2}; t = {1, 3, 5, 7, 8, 10}; ts = TimeSeries[v, {t}];
Wolfram Language code: Variance[ts]//N

The variance depends only on the values:

Wolfram Language code: Variance[ts["Values"]]//N

Find the variance of data involving quantities:

Wolfram Language code: data = Quantity[RandomReal[1, 6], "Meters"]
Wolfram Language code: Variance[data]

Array Data  (5)

Variance for a matrix gives columnwise variances:

Wolfram Language code: Variance[Array[Subscript[a, Row@{##}]&, {2, 2}]]
Wolfram Language code: %//TraditionalForm

Variance for a tensor gives columnwise variances at the first level:

Wolfram Language code: Variance[Array[Subscript[a, Row@{##}]&, {2, 2, 2}]]
Wolfram Language code: %//TraditionalForm//MatrixForm

Works with large arrays:

Wolfram Language code: Variance[RandomReal[1, 10 ^ 7]]
Wolfram Language code: Variance[RandomReal[1, {10 ^ 6, 5}]]

When the input is an Association, Variance works on its values:

Wolfram Language code: mat = RandomReal[1, {3, 2}]; assoc = AssociationThread[Range[3], mat]
Wolfram Language code: Variance[assoc]

SparseArray data can be used just like dense arrays:

Wolfram Language code: Variance[SparseArray[{{1} -> 1, {100} -> 1}]]
Wolfram Language code: Variance[SparseArray[{{1, 1} -> 1, {2, 2} -> 2, {3, 3} -> 3, {1, 3} -> 4}]]

Find the variance of a QuantityArray:

Wolfram Language code: data = QuantityArray[RandomReal[1, 6], "Pounds"]
Wolfram Language code: Variance[data]

Image and Audio Data  (2)

Channelwise variance of an RGB image:

Wolfram Language code: Variance[[image]]

Variance of a grayscale image:

Wolfram Language code: Variance[[image]]

On audio objects, Variance works channelwise:

Wolfram Language code: a = ExampleData[{"Audio", "Bee"}]
Wolfram Language code: AudioMeasurements[a, "Channels"]
Wolfram Language code: Variance[a]

Date and Time  (5)

Compute variance of dates:

Wolfram Language code: dates = WolframLanguageData[All, "DateIntroduced"];
Wolfram Language code: DateHistogram[dates]
Wolfram Language code: Variance[dates]
Wolfram Language code: UnitConvert[%, "Years" ^ 2]

Compute the weighted variance of dates:

Wolfram Language code: dates = RandomDate[4]
Wolfram Language code: weights = {1, 1, 1, 3};
Wolfram Language code: Variance[WeightedData[dates, weights]]

Compute the variance of dates given in different calendars:

Wolfram Language code: dates = {DateObject[{2024, 2, 29}, CalendarType -> "Julian"], DateObject[{1524, 1, 1}, CalendarType -> "Islamic"], DateObject[{6024, 1, 15}, CalendarType -> "Jewish"]}
Wolfram Language code: Variance[dates]
Wolfram Language code: UnitConvert[%, "Centuries" ^ 2]

Compute the variance of times:

Wolfram Language code: times = RandomTime[3]
Wolfram Language code: Variance[times]

Compute the variance of times with different time zone specifications:

Wolfram Language code: times = {TimeObject[{12}, TimeZone -> 0], TimeObject[{12}, TimeZone -> 2], TimeObject[{12}, TimeZone -> "Asia/Tokyo"]}
Wolfram Language code: Variance[times]

Distributions and Processes  (3)

Find the variance for univariate distributions:

Wolfram Language code: Variance[BinomialDistribution[n, p]]
Wolfram Language code: Variance[NormalDistribution[μ, σ]]

Multivariate distributions:

Wolfram Language code: Variance[MultivariateHypergeometricDistribution[n, {Subscript[m, 1], Subscript[m, 2]}]]
Wolfram Language code: Variance[BinormalDistribution[{Subscript[μ, 1], Subscript[μ, 2]}, {σ1, σ2}, ρ]]

Variance for derived distributions:

Wolfram Language code: Variance[TransformedDistribution[x^2, xNormalDistribution[μ, σ]]]
Wolfram Language code: Variance[ProbabilityDistribution[(Sqrt[2] / π)(1 / (1 + (x - 2)^4)), {x, -∞, ∞}]]

Data distribution:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 3];
Wolfram Language code: Variance[HistogramDistribution[data]]

Variance function for a random process:

Wolfram Language code: Variance[BrownianBridgeProcess[a, b][t]]
Wolfram Language code: Plot[Evaluate[% /. {a -> 3, b -> 5}], {t, 3, 5}, PlotRange -> All]

Applications  (5)

Variance is a measure of dispersion:

Wolfram Language code: 𝒟 = NormalDistribution[0, σ];
Wolfram Language code: Variance[𝒟]
Wolfram Language code: Table[Plot[PDF[𝒟, x], {x, -4, 4}, PlotRange -> {0, 0.4}, Filling -> Axis, Ticks -> {Automatic, None}, PlotLabel -> Row[{"SuperscriptBox[σ, 2] = ", σ^2}]], {σ, {1, 1.5, 2}}]

Compute a moving variance for samples of three random processes:

Wolfram Language code: times = {0, 1, .01}; td1 = RandomFunction[WienerProcess[], times]; td2 = RandomFunction[OrnsteinUhlenbeckProcess[0, 1, 1 / 3, 0], times]; td3 = RandomFunction[FractionalBrownianMotionProcess[1 / 4], times];
Wolfram Language code: ListLinePlot[{td1, td2, td3}, PlotRange -> All, PlotLegends -> (lgd = {"Wiener process sample", "Ornstein-Uhlenbeck process sample", "FBM process sample"})]

Compare data volatility by smoothing with moving variance:

Wolfram Language code: mvar = Map[MovingMap[Variance, #, Quantity[20, "Events"]]&, {td1, td2, td3}];
Wolfram Language code: ListLinePlot[mvar, PlotRange -> All, PlotLegends -> lgd]

Find the mean and variance for the number of great inventions and scientific discoveries in each year from 1860 to 1959:

Wolfram Language code: data = ExampleData[{"Statistics", "ScientificDiscoveries"}, "EventSeries"]
Wolfram Language code: ListPlot[data, Filling -> 0]
Wolfram Language code: {Mean[data], Variance[data]}//N

Investigate weak stationarity of the process data by analyzing variance of slices:

Wolfram Language code: data = TemporalData[«4»];
Wolfram Language code: times = Range[0, 1, .1];
Wolfram Language code: var = Map[{#, Variance[data[#]]}&, times];
Wolfram Language code: ListLinePlot[var]

Use a larger plot range to see how relatively small the variations are:

Wolfram Language code: ListLinePlot[var, PlotRange -> {0, .5}]

Find the variance of the heights for the children in a class:

Wolfram Language code: heights = Quantity[{134, 143, 131, 140, 145, 136, 131, 136, 143, 136, 133, 145, 147, 150, 150, 146, 137, 143, 132, 142, 145, 136, 144, 135, 141}, "Centimeters"];
Wolfram Language code: ListPlot[heights, Filling -> Axis, AxesLabel -> Automatic]
Wolfram Language code: Variance[heights]//N

Properties & Relations  (11)

The square root of Variance is StandardDeviation:

Wolfram Language code: Variance[{1, 2, 3, 4}]
Wolfram Language code: StandardDeviation[{1, 2, 3, 4}]

Variance is a scaled squared Norm of deviations from the Mean:

Wolfram Language code: data = RandomReal[10, 20];
Wolfram Language code: Variance[data]
Wolfram Language code: Norm[data - Mean[data]] ^ 2 / (Length[data] - 1)

Variance is a scaled CentralMoment:

Wolfram Language code: data = RandomReal[10, 20];
Wolfram Language code: Variance[data]
Wolfram Language code: CentralMoment[data, 2] Length[data] / (Length[data] - 1)

The square root of Variance is a scaled RootMeanSquare of the deviations:

Wolfram Language code: data = RandomReal[10, 10];
Wolfram Language code: RootMeanSquare[data - Mean[data]]Sqrt[Length[data] / (Length[data] - 1)]
Wolfram Language code: Variance[data]//Sqrt

Variance is a scaled Mean of squared deviations from the Mean:

Wolfram Language code: data = RandomReal[5, 20];
Wolfram Language code: Variance[data]
Wolfram Language code: Mean[(data - Mean[data]) ^ 2] Length[data] / (Length[data] - 1)

Variance is a scaled SquaredEuclideanDistance from the Mean:

Wolfram Language code: data = RandomReal[10, 20];
Wolfram Language code: mean = Mean[data]
Wolfram Language code: len = Length[data]
Wolfram Language code: SquaredEuclideanDistance[data, Table[mean, {len}]] / (len - 1)
Wolfram Language code: Variance[data]

Variance is less than MeanDeviation if all absolute deviations are less than 1:

Wolfram Language code: data = RandomReal[1, 10];
Wolfram Language code: MeanDeviation[data]
Wolfram Language code: Variance[data]

Variance is greater than MeanDeviation if all absolute deviations are greater than 1:

Wolfram Language code: data = Join[RandomReal[{1, 2}, 5], RandomReal[{5, 6}, 5]];
Wolfram Language code: MeanDeviation[data]
Wolfram Language code: Variance[data]

Variance of a random variable as an Expectation:

Wolfram Language code: dist = GammaDistribution[α, β];
Wolfram Language code: Expectation[(x - Mean[dist]) ^ 2, xdist]
Wolfram Language code: Variance[dist]

Variance gives an unbiased sample estimate:

Wolfram Language code: n = 6; var = Variance[Array[Subscript[x, #]&, n]] /. Conjugate -> Identity

Unbiased means that the expected value of the sample variance with respect to the population distribution equals the variance of the underlying distribution:

Wolfram Language code: Table[Expectation[var, Array[Subscript[x, #]dist&, n]], {dist, {UniformDistribution[], ExponentialDistribution[λ], NormalDistribution[μ, σ]}}]
Wolfram Language code: Variance /@ {UniformDistribution[], ExponentialDistribution[λ], NormalDistribution[μ, σ]}

Variance gives an unbiased weighted sample estimate:

Wolfram Language code: n = 5; wdata = WeightedData[Array[Subscript[x, #]&, n], Array[Subscript[w, #]&, n]]
Wolfram Language code: (var = Variance[wdata])//Short

Unbiased means that the expected value of the sample variance with respect to the population distribution equals the variance of the underlying distribution:

Wolfram Language code: Table[Expectation[var, Array[Subscript[x, #]dist&, n]], {dist, {BetaDistribution[α, β], GammaDistribution[α, β], NormalDistribution[μ, σ]}}]
Wolfram Language code: Variance /@ {BetaDistribution[α, β], GammaDistribution[α, β], NormalDistribution[μ, σ]}

Possible Issues  (1)

Variance does not handle Missing directly:

Wolfram Language code: data = {1.21, 3.4, 2.15, Missing[], 1.55}; Variance[data]

Convert data to a TabularColumn to use the non-missing values for computation:

Wolfram Language code: Variance[TabularColumn[data]]

Use Query:

Wolfram Language code: Query[Variance][data]

Neat Examples  (1)

The distribution of Variance estimates for 20, 100, and 300 samples:

Wolfram Language code: Variance[ExponentialDistribution[0.9]]
Wolfram Language code: SmoothHistogram[Table[Variance[RandomVariate[ExponentialDistribution[0.9], {s, 1000}]], {s, {20, 100, 300}}], Filling -> Axis, PlotLegends -> {20, 100, 300}, PlotRange -> {{0, 3}, Automatic}]

See Also

StandardDeviation  Covariance  Correlation  TrimmedVariance  WinsorizedVariance  BiweightMidvariance  QnDispersion  SnDispersion  Mean  MeanDeviation  MedianDeviation  Kurtosis  CentralMoment  Expectation

Function Repository: PopulationVariance  VarianceAround  VarianceRatioCI  PooledVariance  GeneralizedVariance  HedgesG

Tech Notes

    ▪
  • Basic Statistics
  • ▪
  • Descriptive Statistics
  • ▪
  • Discrete Distributions
  • ▪
  • Continuous Distributions

Related Guides

    ▪
  • Descriptive Statistics
  • ▪
  • Statistical Data Analysis
  • ▪
  • GPU Computing
  • ▪
  • Math & Counting Operations on Lists
  • ▪
  • Statistical Moments and Generating Functions
  • ▪
  • Numerical Data
  • ▪
  • Scientific Data Analysis
  • ▪
  • Precollege Education
  • ▪
  • Time Series Processing
  • ▪
  • Image Processing & Analysis
  • ▪
  • Finite Mathematics
  • ▪
  • Probability & Statistics
  • ▪
  • GPU Computing with Apple
  • ▪
  • GPU Computing with NVIDIA
  • ▪
  • Date & Time
  • ▪
  • Event Series Processing
  • ▪
  • Signal Visualization & Analysis
  • ▪
  • Audio Processing
  • ▪
  • Symbolic Vectors, Matrices and Arrays

History

Introduced in 2003 (5.0) | Updated in 2007 (6.0) ▪ 2023 (13.3) ▪ 2024 (14.1)

Wolfram Research (2003), Variance, Wolfram Language function, https://reference.wolfram.com/language/ref/Variance.html (updated 2024).

Text

Wolfram Research (2003), Variance, Wolfram Language function, https://reference.wolfram.com/language/ref/Variance.html (updated 2024).

CMS

Wolfram Language. 2003. "Variance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Variance.html.

APA

Wolfram Language. (2003). Variance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Variance.html

BibTeX

@misc{reference.wolfram_2026_variance, author="Wolfram Research", title="{Variance}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Variance.html}", note=[Accessed: 01-September-2026]}

BibLaTeX

@online{reference.wolfram_2026_variance, organization={Wolfram Research}, title={Variance}, year={2024}, url={https://reference.wolfram.com/language/ref/Variance.html}, note=[Accessed: 01-September-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English