# Convex combination

## Introduction

In convex geometry, a convex combination is a linear combination of points (which can be vectors, scalars, or more generally points in an affine space) where all coefficients are non-negative and sum to 1. [1]

## Definition - Convex Combination

More formally, given a finite number of points ${\displaystyle x_{1},x_{2},\dots ,x_{n}}$  in a real vector space, a convex combination of these points is a point of the form

${\displaystyle \lambda _{1}x_{1}+\lambda _{2}x_{2}+\cdots +\lambda _{n}x_{n}}$

where the real numbers ${\displaystyle \lambda _{i}}$  satisfy ${\displaystyle \lambda _{i}\geq 0}$  and ${\displaystyle \lambda _{1}+\lambda _{2}+\cdots +\lambda _{n}=1.}$ [1]

### Remark - outside of convex hull

In the animation of the tetraeder there are examples of points that

• fulfill ${\displaystyle \lambda _{1}+\lambda _{2}+\cdots +\lambda _{n}=1}$ , but
• violate the condition ${\displaystyle \lambda _{i}\geq 0}$ .

In case that on ${\displaystyle \lambda _{i}}$  is negativ, then linear combination

${\displaystyle \lambda _{1}x_{1}+\lambda _{2}x_{2}+\cdots +\lambda _{n}x_{n}}$

is a point outside the tetraeder (see animation and consider, when values become negative.

## Convex combinations in the plane

If we consider a convex combinations in the plane, then the underlying vector space is the two-dimensional space ${\displaystyle V:=\mathbb {R} ^{2}}$ . First, we consider convex combinations of two vectors in ${\displaystyle \mathbb {R} ^{2}}$ . Later we transfer that to infinite dimensional vector spaces of functions and visualize convex combination as GIF animation with Open Source Geogebra. By the condition ${\displaystyle \lambda _{1}+\lambda _{2}=1}$ , scalars are interdependent. For example, if we define ${\displaystyle t\in [0,1]}$ , then we can set ${\displaystyle \lambda _{1}:=(1-t)}$  and ${\displaystyle \lambda _{2}:=t}$ .

## Convex combinations as mappings into the vector space

### Convex Combination as a Mapping

Now we consider the convex combination as a mapping ${\displaystyle K\colon [0,1]\to V}$  into the underlying vector space. Due to the fact that the equation can generally represent 1st order convex combinations of 2 vectors ${\displaystyle v_{1},v_{2}\in V}$  as follows over the mapping ${\displaystyle K}$ :

${\displaystyle K(t):=(1-t)\cdot v_{1}+t\cdot v_{2}}$

### Convex Combination of 2 Points

As a particular example, every convex combination of two points lies on the line segment between the points.[1]

### Convex Combination of 2 Functions as Vectors

Let ${\displaystyle [a,b]=[4,7]}$  and as the first function ${\displaystyle f:[a,b]\to \mathbb {R} }$  a polynomial is defined.

${\displaystyle f(x):={\frac {3}{10}}\cdot x^{2}-2}$

A trigonometric function ${\displaystyle g:[a,b]\to \mathbb {R} }$  was chosen as the second function.

${\displaystyle g(x):=2\cdot cos(x)+1}$

The following figure illustrates the convex combination ${\displaystyle K(t):=(1-t)\cdot f+t\cdot g}$ .

### Remark - Deformation

If the first function ${\displaystyle f}$  describes the initial shape and ${\displaystyle g}$  the target shape. A convex combinations of those functions can describe (e.g. in computer graphics) a continuous deformation of an initial shape into a target shape.

### Convex combination of more than 2 Points

The figure above, the point ${\displaystyle P}$  is a convex combination of the three points, while ${\displaystyle Q}$  is not. (${\displaystyle Q}$  is however an affine combination of the three points, as their affine hull is the entire plane.)]]

### Convex combination of n points

A set is convex if it contains all convex combinations of its points. The convex hull of a given set of points is identical to the set of all their convex combinations.[1]

${\displaystyle {\begin{array}{rcl}v&=&\lambda _{1}v_{1}+\lambda _{2}v_{2}+\dotsb +\lambda _{n}v_{n}\\&=&\sum _{i=1}^{n}\lambda _{i}v_{i},\\&{\mbox{mit}}&0\leq \lambda _{i}\leq 1,\quad \sum _{i=1}^{n}\lambda _{i}=1\,.\end{array}}}$

### Linear Combintations and Convex Combinations

There exist subsets of a vector space that are not closed under linear combinations but are closed under convex combinations. For example, the interval ${\displaystyle [0,1]}$  is convex but generates the real-number line under linear combinations. Another example is the convex set of probability distributions, as linear combinations preserve neither nonnegativity nor affinity (i.e., having total integral one).

## Convex combinations of convex combinations

In the animation above you can see a convex combination of 2 vectors in the plane or in a function space. If one uses three points then one can create a 1st order convex combination between every two points. We will now consider higher order convex combinations by constructing e.g. a 2nd order convex combination generated from two 1st order convex combinations. Generally from 2 convex combinations of order ${\displaystyle n}$  you can create a convex combination of order ${\displaystyle n+1}$ .

### Convex hull

The set of all convex combinations of a given set of vectors is called a convex hull (see also p-convex hull).

### Remarks video about convex combinations of order 1, 2 and 3 in Geogebra

In the video you can see convex combinations of the

• 1st order between ${\displaystyle A_{1}}$  and ${\displaystyle B_{1}}$  without auxiliary points,
• 2nd order between ${\displaystyle A_{2}}$  and ${\displaystyle B_{2}}$  with auxiliary point ${\displaystyle S_{1}}$ ,
• 3rd order between ${\displaystyle A_{3}}$  and ${\displaystyle B_{3}}$  with auxiliary points ${\displaystyle H_{1},H_{2}}$ ,

## Convex combinations as polynomials of t

Convex combinations can be conceived as polynomials where the coefficients come from a vector space ${\displaystyle (V,+,\cdot ,\mathbb {R} )}$  (see also Polynomial Algebra). For example, if one chooses ${\displaystyle V:=\mathbb {R} ^{n}}$ , one can take a convex combination ${\displaystyle K}$  to be an element of Polynomial Algebra ${\displaystyle V[t]}$ .

### 3D convex combination - 1st order

For example, choosing ${\displaystyle n=3}$  and ${\displaystyle V:=\mathbb {R} ^{3}}$ , a 1st order convex combination is defined as follows.

${\displaystyle A={\begin{pmatrix}1\\2\\4\end{pmatrix}},\,B={\begin{pmatrix}4\\1\\0\end{pmatrix}},\,\,K(t):=(1-t)\cdot A+t\cdot B=(B-A)\cdot t+A}$

Thus, a 1st order convex combination yields a polynomial of degree 1. with argument ${\displaystyle t}$ . Represent the convex combination in Geogebra 3D with ${\displaystyle t\in [0,1]}$  (see also Representation of a Straight Line by Direction Vector and Location Vector).

### 3D convex combination - 2nd order

Choosing again ${\displaystyle n=3}$  and ${\displaystyle V:=\mathbb {R} ^{3}}$  with an auxiliary point ${\displaystyle H_{1}\in V}$ , two 1st order convex combinations yield 2nd order convex combinations.

${\displaystyle H_{1}={\begin{pmatrix}2\\2\\2\end{pmatrix}},{\begin{array}{rcl}K_{(1,1)}(t)&:=&(H_{1}-A)\cdot t+A\\K_{(1,2)}(t)&:=&(B-H_{1})\cdot t+H_{1}\\K_{2}(t)&:=&((H_{1}-A)\cdot t+A)\cdot (1-t)+((B-H_{1})\cdot t+H_{1})\cdot t\end{array}}}$

Represent ${\displaystyle K_{2}}$  as a polynomial ${\displaystyle K_{2}(t)=P_{2}\cdot t^{2}+P_{1}\cdot t^{1}+P_{0}\cdot t^{0}}$  and calculate for ${\displaystyle n=2}$  (${\displaystyle n=3,4,...}$ ) the coefficients in ${\displaystyle P_{k}\in V=\mathbb {R} ^{3}}$ .

### Bernstein polynomial - order 1

${\displaystyle {\begin{array}{rcl}K_{1}(t)&:=&A\cdot (1-t)+B\cdot t\\&=&A\cdot (1-t)^{1}\cdot t^{0}+B\cdot (1-t)^{0}\cdot t^{1}\\\end{array}}}$

### Calculation of the polynomial - order 2

${\displaystyle {\begin{array}{rcl}K_{2}(t)&:=&((H_{1}-A)\cdot t+A)\cdot (1-t)+((B-H_{1})\cdot t+H_{1})\cdot t\\&=&(H_{1}\cdot t-A\cdot t+A)-(H_{1}\cdot t^{2}-A\cdot t^{2}+A\cdot t)\\&&+(B\cdot t^{2}-H_{1}\cdot t^{2}+H_{1}\cdot t)\\&=&(B-H_{1}+A)\cdot t^{2}+2\cdot (H_{1}-A)\cdot t+A\end{array}}}$

### Bernstein polynomial - order 2

${\displaystyle {\begin{array}{rcl}K_{2}(t)&:=&((H_{1}-A)\cdot t+A)\cdot (1-t)+((B-H_{1})\cdot t+H_{1})\cdot t\\&=&A\cdot (1-t)^{2}+2\cdot H_{1}\cdot t\cdot (1-t)+B\cdot t^{2}\end{array}}}$

### Bernstein polynomial - order 3

${\displaystyle {\begin{array}{rcl}K_{3}(t)&:=&A\cdot (1-t)^{3}+3\cdot H_{1}\cdot (1-t)^{2}\cdot t+3\cdot H_{2}\cdot (1-t)\cdot t^{2}+B\cdot t^{3}\end{array}}}$

## Convex combination as a mapping

A convex combination can be used to interpolate points ${\displaystyle A=v_{1}}$  and ${\displaystyle B=v_{n}}$ . Furthermore, if the auxiliary points ${\displaystyle H_{1}=v_{2}}$ ,....${\displaystyle H_{n_{1}}=v_{n-1}}$  are given for a convex combination ${\displaystyle n}$ -th order. The convex combinations can be generally thought of as mapping from the interval ${\displaystyle [0,1]}$  to ${\displaystyle \mathbb {R} ^{n}}$  as follows:

${\displaystyle {\begin{array}{rcl}K_{n}:&[0,1]&\rightarrow &\mathbb {R} ^{n}\\&t&\mapsto &\displaystyle \sum _{k=0}^{n}{n \choose k}(1-t)^{n-k}\cdot t^{k}\cdot v_{k+1}\\&&&={n \choose 0}(1-t)^{n}v_{1}+{n \choose 1}(1-t)^{n-1}tv_{2}+\ldots +{n \choose n}t^{n}v_{n}\end{array}}}$

## Interpolations

Convex combinations can also be used to interpolate polynomials. Start first with first order interpolations by interpolating the points with straight lines of the form ${\displaystyle f_{k}(x):=m_{k}\cdot x+b_{k}}$ . Here, the points ${\displaystyle \mathbb {D} :=\{(x_{0},y_{0}),\ldots ,(x_{n},y_{n})\}}$  are given data points that are interpolated piecewise using the functions ${\displaystyle f_{k}(x):=m_{k}\cdot x+b_{k}}$ . Compute from the convex combinations ${\displaystyle P_{k}(t)\in \mathbb {R} ^{2}}$  the functional representation ${\displaystyle f_{k}:[x_{k-1},x_{k}]\to \mathbb {R} }$  with ${\displaystyle f_{k}(x):=m_{k}\cdot x+b_{k}}$ :

${\displaystyle P_{k}(t):=(1-t)\cdot {\begin{pmatrix}x_{k-1}\\y_{k-1}\end{pmatrix}}+t\cdot {\begin{pmatrix}x_{k}\\y_{k}\end{pmatrix}}}$

### Calculation of t as a function of x

Given ${\displaystyle x\in [x_{k-1},x_{k}]\subset \mathbb {R} }$ . We now compute the corresponding ${\displaystyle t\in [0,1]}$  for the convex combination with the preliminary consideration that ${\displaystyle t=0}$  for ${\displaystyle x=x_{k-1}}$  and ${\displaystyle t=1}$  for ${\displaystyle x=x_{k}}$ . The following figure takes the linear transformation ${\displaystyle T:[x_{k-1},x_{k}]\to [0,1]}$ .

${\displaystyle T(x):={\frac {x-x_{k-1}}{x_{k}-x_{k-1}}}}$

### Calculation of the function value at x

The convex combination

${\displaystyle P_{k}(t):=(1-t)\cdot {\begin{pmatrix}x_{k-1}\\y_{k-1}\end{pmatrix}}+t\cdot {\begin{pmatrix}x_{k}\\y_{k}\end{pmatrix}}}$

gives the interpolation point of the graph. However, we only need the y-coordinate of the corresponding interpolation point ${\displaystyle P_{k}(t)={\begin{pmatrix}(1-t)\cdot x_{k-1}+t\cdot x_{k}\\(1-t)\cdot y_{k-1}+t\cdot y_{k}\end{pmatrix}}}$ . So we use the following term: ${\displaystyle (1-t)\cdot y_{k-1}+t\cdot y_{k}}$ .

### Functional representation

Substituting for ${\displaystyle t\in [0,1]}$  gives the linear interpolation function ${\displaystyle f_{k}:[x_{k-1},x_{k}]\to \mathbb {R} }$  over:

${\displaystyle f_{k}(x):={\bigg (}1-\underbrace {\frac {x-x_{k-1}}{x_{k}-x_{k-1}}} _{=t}{\bigg )}\cdot y_{k-1}+{\bigg (}\underbrace {\frac {x-x_{k-1}}{x_{k}-x_{k-1}}} _{=t}{\bigg )}\cdot y_{k}}$ .

• Calculate the coefficients ${\displaystyle m_{k},b_{k}\in \mathbb {R} }$  of the function ${\displaystyle f_{k}:[x_{k-1},x_{k}]\to \mathbb {R} }$  with ${\displaystyle f_{k}(x):=m_{k}\cdot x+b_{k}}$ !
• Transfer this interpolation to convex combination of order 3 and consider how, depending on the data points, you must choose the two auxiliary points of the interpolation so that the interpolation is differentiable and generates differentiable transitions between the interpolation points in the plot.
• What geometric properties must auxiliary points between two adjacent interpolation intervals have for differentiability.

### Interpolation with convex combination of order 3

Develop a mathematical/algebraic description by terms for the following:

• The green stippled lines are 1st order convex combinations,
• At the vertices of the open Polygon course, create an angle bisector (constructively, this can be implemented by a rhombus, where two sides and a vertex are defined by two adjacent lines in the polygon course).
• Create an orthogonal through the connection point of two adjacent lines in the polygon course.
• Analyze the figure above and determine the next steps for defining the two auxiliary points for a 3rd order convex combination. The procedure is not clear especially at the boundary points of the polygon course. What speaks to your choice of mathematical implementation?

Use altogether methods from linear algebra (e.g. scalar product,... for the vectorial description of the above geometric procedure.

## Morphing and the use of convex combinations

In the following section we will consider transformations of images in the context of convex combinations. In Morphing there are different mathematical tools. Here we will only consider aspects in the context of convex combinations.

• Look at the above GIF animation and first take two different black and white images transform the first image pixel by pixel to the second image by applying a convex combination from gray level values (black=0,...255=white) of a pixel in image 1 to a pixel in image 2 (implementation e.g. in Octave Image Processing v7.3.0 or Octave Image Processing v5.2.0. Note that the convex combinations yields real values of brightness in the gray levels, which must rounded to integer values (e.g. 232.423 to 232 = approximately white). This is necessary due to that the fact that brightness encoding is done with 256 values (Byte).
• Transfer the procedure to color images only, similarly transferring color values for the primary colors from grayscale values to color values.
• In the above morphing animation, however, not only static pixel-by-pixel convex combinations are made, but for fixedly defined points, such as eyes, a spatial transformation process also takes place. Consider how, for example, the center of the iris in the eye is spatially shifted from image1 to image2.
• now connect spatial transformation processes with a color adjustment of the pixels, so that a pixel moves from the location ${\displaystyle (x_{1},y_{1})}$  in the image matrix to ${\displaystyle (x_{2},y_{2})}$  and on the way from ${\displaystyle (x_{1},y_{1})}$  to ${\displaystyle (x_{2},y_{2})}$  the color changes from yellow to blue.

## CAS4Wiki

With the following CAS4Wiki commands you can play around with the definition of curves in ${\displaystyle \mathbb {R} ^{2}}$

Curves in ${\displaystyle \mathbb {R} ^{2}}$  and ${\displaystyle \mathbb {R} ^{3}}$

## Other objects

• Similarly, a convex combination ${\displaystyle X}$  of random variables ${\displaystyle Y_{i}}$  is a weighted sum (where ${\displaystyle \alpha _{i}}$  satisfy the same constraints as above) of its component probability distributions, often called a finite mixture distribution, with probability density function:
${\displaystyle f_{X}(x)=\sum _{i=1}^{n}\lambda _{i}f_{Y_{i}}(x)}$

## Related constructions

• Linear Combination
• A conical combination is a linear combination with nonnegative coefficients. When a point ${\displaystyle x}$  is to be used as the reference origin for defining displacement vectors, then ${\displaystyle x}$  is a convex combination of ${\displaystyle n}$  points ${\displaystyle x_{1},x_{2},\dots ,x_{n}}$  if and only if the zero displacement is a non-trivial conical combination of their ${\displaystyle n}$  respective displacement vectors relative to ${\displaystyle x}$ .
• Weighted means are functionally the same as convex combinations, but they use a different notation. The coefficients (weights) in a weighted mean are not required to sum to 1; instead the weighted linear combination is explicitly divided by the count of the weights.
• Affine combinations are like convex combinations, but the coefficients are not required to be non-negative. Hence affine combinations are defined in vector spaces over any field.

## References

1. Rockafellar, R. Tyrrell (1970), Convex Analysis, Princeton Mathematical Series, vol. 28, Princeton University Press, Princeton, N.J., pp. 11–12, MR 0274683

## Page Information

You can display this page as Wiki2Reveal slides

### Wiki2Reveal

The Wiki2Reveal slides were created for the Linear algebra' and the Link for the Wiki2Reveal Slides was created with the link generator.

### Wikipedia2Wikiversity

This page was based on the following Wikipedia source page: