# Lines from Convex Combinations

##### Written in Math, Linear Algebra

## Line from origin to a point

We can define a line **going through** the origin and point *v* as

{αv: α ∈ R}

And we can define a line from the origin **up to** a point *v* as

{αv: 0 <= α <= 1}

Were α is some scalar

## Line from point to point (based off a line from the origin)

What if we want to define a line that does not start or end at the origin. We can do this by adding an offset to the previous equations.

### Infanite line through two points

For example, say we wanted to represent a line **going through** the points (2,2) and (6,4)

We could use the the fallowing base equation to represent a line going through the origin

{α(4,2): α ∈ R}

and then apply the offset (2,2) which results in a line **going through** points (2,2) and (6,4)

{α(4,2) + (2,2): α ∈ R}

### How did we get offset (2,2)?

Since (2,2) is the *start point* of the new line, and the origin (0,0) is the start point of the *original line*, we need to add (2,2) to move the start point of the original line to that of the new line. Therefore, if we subtract (2,2) from the end point of the new line, we get the end point of the original line.

### Line between two points

The previous equations give us an infanite line between two points. If we wanted a line that's only between the two points, all we have to do is limit the scalar to the range of 0 throguh 1

{α(4,2) + (2,2): 0 <= α <= 1}

## Line bwtween point to point - Convex Combinations

The previous equations only use one endpoint but not the other (use (2,2) but not (6,4)).

Throguh some algebrea majick we can transform the equation into something cleaner and nicer and called a Convex Combination (or more percicly a set of Convex Combinations)

First off, to obtain a line between two points (2,2) (6,4), we can use the fallowing equation

{s*(originalEndpoint) + offset : 0 <= s <= 1}

{s(4,2) + (2,2): 0 <= s <= 1}

The variables are defined as fallows

s = some scalar value between 0 and 1

newEndpoint = (6,4)

newStartpoint = (2,2)

offset = newStartpoint (or more exactly origin (0,0) + newStartpoint)

originalEndpoint = newEndpoint - offset = (4,2)

Using some algebrea sorcery we can transform the above euqation into

{ s * (newEndpoint - offset) + offset ...}

{ s*newEndpoint - s*offset + 1*offset ...}

{ s*newEndpoint + (1-s)*offset ...}

and if we assing the the result of *1-s* to the variable *b* we get

{ s*newEndpoint + b*offset }

Where s is some scalar between 0 and 1 and b is the result of 1 - s or in other words, s+b must = 1.

This creates a set of convex combinations, where a Convex Combination is defined as an expression of the form α u + β v where α, β ≥ 0 and α + β = 1