### Weighted sum

A weight function is a mathematical device used when performing a sum, integral, or average to give some elements more "weight" or influence on the result than other elements in the same set. They occur frequently in statistics and analysis, and are closely related to the concept of a measure. Weight functions can be employed in both discrete and continuous settings. They can be used to construct systems of calculus called "weighted calculus"[1] and "meta-calculus".[2]

## Discrete weights

### General definition

In the discrete setting, a weight function $\scriptstyle w\colon A \to \left\{\Bbb R\right\}^+$ is a positive function defined on a discrete set $A$, which is typically finite or countable. The weight function corresponds to the unweighted situation in which all elements have equal weight. One can then apply this weight to various concepts.

If the function $\scriptstyle f\colon A \to \left\{\Bbb R\right\}$ is a real-valued function, then the unweighted sum of $f$ on $A$ is defined as

$\sum_\left\{a \in A\right\} f\left(a\right);$

but given a weight function $\scriptstyle w\colon A \to \left\{\Bbb R\right\}^+$, the weighted sum or conical combination is defined as

$\sum_\left\{a \in A\right\} f\left(a\right) w\left(a\right).$

One common application of weighted sums arises in numerical integration.

If B is a finite subset of A, one can replace the unweighted cardinality |B| of B by the weighted cardinality

$\sum_\left\{a \in B\right\} w\left(a\right).$

If A is a finite non-empty set, one can replace the unweighted mean or average

$\frac\left\{1\right\}\left\{|A|\right\} \sum_\left\{a \in A\right\} f\left(a\right)$

by the weighted mean or weighted average

$\frac\left\{\sum_\left\{a \in A\right\} f\left(a\right) w\left(a\right)\right\}\left\{\sum_\left\{a \in A\right\} w\left(a\right)\right\}.$

In this case only the relative weights are relevant.

### Statistics

Weighted means are commonly used in statistics to compensate for the presence of bias. For a quantity $f$ measured multiple independent times $f_i$ with variance $\scriptstyle\sigma^2_i$, the best estimate of the signal is obtained by averaging all the measurements with weight $\scriptstyle w_i=\frac 1 \left\{\sigma_i^2\right\}$, and the resulting variance is smaller than each of the independent measurements $\scriptstyle\sigma^2=1/\sum w_i$. The Maximum likelihood method weights the difference between fit and data using the same weights $w_i$.

### Mechanics

The terminology weight function arises from mechanics: if one has a collection of $n$ objects on a lever, with weights $\scriptstyle w_1, \dotsc, w_n$ (where weight is now interpreted in the physical sense) and locations :$\scriptstyle\boldsymbol\left\{x\right\}_1,\dotsc,\boldsymbol\left\{x\right\}_n$, then the lever will be in balance if the fulcrum of the lever is at the center of mass

$\frac\left\{\sum_\left\{i=1\right\}^n w_i \boldsymbol\left\{x\right\}_i\right\}\left\{\sum_\left\{i=1\right\}^n w_i\right\},$

which is also the weighted average of the positions $\scriptstyle\boldsymbol\left\{x\right\}_i$.

## Continuous weights

In the continuous setting, a weight is a positive measure such as $w\left(x\right) dx$ on some domain $\Omega$,which is typically a subset of a Euclidean space $\scriptstyle\left\{\Bbb R\right\}^n$, for instance $\Omega$ could be an interval $\left[a,b\right]$. Here $dx$ is Lebesgue measure and $\scriptstyle w\colon \Omega \to \R^+$ is a non-negative measurable function. In this context, the weight function $w\left(x\right)$ is sometimes referred to as a density.

### General definition

If $f\colon \Omega \to \left\{\Bbb R\right\}$ is a real-valued function, then the unweighted integral

$\int_\Omega f\left(x\right)\ dx$

can be generalized to the weighted integral

$\int_\Omega f\left(x\right) w\left(x\right)\, dx$

Note that one may need to require $f$ to be absolutely integrable with respect to the weight $w\left(x\right) dx$ in order for this integral to be finite.

### Weighted volume

If E is a subset of $\Omega$, then the volume vol(E) of E can be generalized to the weighted volume

$\int_E w\left(x\right)\ dx,$

### Weighted average

If $\Omega$ has finite non-zero weighted volume, then we can replace the unweighted average

$\frac\left\{1\right\}\left\{\mathrm\left\{vol\right\}\left(\Omega\right)\right\} \int_\Omega f\left(x\right)\ dx$

by the weighted average

$\frac\left\{\int_\Omega f\left(x\right)\ w\left(x\right) dx\right\}\left\{\int_\Omega w\left(x\right)\ dx\right\}$

### Inner product

If $\scriptstyle f\colon \Omega \to \left\{\Bbb R\right\}$ and $\scriptstyle g\colon \Omega \to \left\{\Bbb R\right\}$ are two functions, one can generalize the unweighted inner product

to a weighted inner product

See the entry on Orthogonality for more details.