Vector valued functions are often encountered in machine learning, computer graphics and computer vision algorithms. They are particularly useful for defining the parametric equations of space curves. It is important to gain a basic understanding of vector valued functions to grasp more complex concepts.

In this tutorial, you will discover what vector valued functions are, how to define them and some examples.

After completing this tutorial, you will know:

Definition of vector valued functions

Derivatives of vector valued functions

Let’s get started.

## Tutorial Overview

This tutorial is divided into two parts; they are:

Definition and examples of vector valued functions

Differentiating vector valued functions

## Definition of a Vector Valued Function

A vector valued function is also called a vector function. It is a function with the following two properties:

The domain is a set of real numbers

The range is a set of vectors

Vector functions are, therefore, simply an extension of scalar functions, where both the domain and the range are the set of real numbers.

In this tutorial we’ll consider vector functions whose range is the set of two or three dimensional vectors. Hence, such functions can be used to define a set of points in space.

Given the unit vectors i,j,k parallel to the x,y,z-axis respectively, we can write a three dimensional vector valued function as:

r(t) = x(t)i + y(t)j + z(t)k

It can also be written as:

r(t) = <x(t), y(t), z(t)>

Both the above notations are equivalent and often used in various textbooks.

### Space Curves and Parametric Equations

We defined a vector function r(t) in the preceding section. For different values of t we get the corresponding (x,y,z) coordinates, defined by the functions x(t), y(t) and z(t). The set of generated points (x,y,z), therefore, define a curve called the space curve C. The equations for x(t), y(t) and z(t) are also called the parametric equations of the curve C.

## Examples of Vector Functions

This section shows some examples of vector valued functions that define space curves. All the examples are also plotted in the figure shown after the examples.

### 1.1 A Circle

Let’s start with a simple example of a vector function in 2D space:

r_1(t) = cos(t)i + sin(t)j

Here the parametric equations are:

x(t) = cos(t)

y(t) = sin(t)

The space curve defined by the parametric equations is a circle in 2D space as shown in the figure. If we vary t from -𝜋 to 𝜋, we’ll generate all the points that lie on the circle.

### 1.2 A Helix

We can extend the r_1(t) function of example 1.1, to easily generate a helix in 3D space. We just need to add the value along the z axis that changes with t. Hence, we have the following function:

r_2(t) = cos(t)i + sin(t)j + tk

### 1.3 A Twisted Cubic

We can also define a curve called the twisted cubic with an interesting shape as:

r_3(t) = ti + t^2j + t^3k

## Derivatives of Vector Functions

We can easily extend the idea of the derivative of a scalar function to the derivative of a vector function. As the range of a vector function is a set of vectors, its derivative is also a vector.

If

r(t) = x(t)i + y(t)j + z(t)k

then the derivative of r(t) is given by r'(t) computed as:

r'(t) = x'(t)i + y'(t)i + z'(t)k

## Examples of Derivatives of Vector Functions

We can find the derivatives of the functions defined in the previous example as:

### 2.1 A Circle

The parametric equation of a circle in 2D is given by:

r_1(t) = cos(t)i + sin(t)j

Its derivative is therefore computed by computing the corresponding derivatives of x(t) and y(t) as shown below:

x'(t) = -sin(t)

y'(t) = cos(t)

This gives us:

r_1′(t) = x'(t)i + y'(t)j

r_1′(t) = -sin(t)i + cos(t)j

The space curve defined by the parametric equations is a circle in 2D space as shown in the figure. If we vary t from -𝜋 to π, we’ll generate all the points that lie on the circle.

### 2.2 A Helix

Similar to the previous example, we can compute the derivative of r_2(t) as:

r_2(t) = cos(t)i + sin(t)j + tk

r_2′(t) = -sin(t)i + cos(t)j + k

### 2.3 A Twisted Cubic

The derivative of r_3(t) is given by:

r_3(t) = ti + t^2j + t^3k

r_3′(t) = i + 2tj + 3t^2k

All the above examples are shown in the figure, where the derivatives are plotted in red. Note the circle’s derivative also defines a circle in space.

## More Complex Examples

Once you gain a basic understanding of these functions, you can have a lot of fun defining various shapes and curves in space. Other popular examples used by the mathematical community are defined below and illustrated in the figure.

**The toroidal spira**l:

r_4(t) = (4 + sin(20t))cos(t)i + (4 + sin(20t))sin(t)j + cos(20t)k

**The trefoil knot**:

r_5(t) = (2 + cos(1.5t)cos (t)i + (2 + cos(1.5t))sin(t)j + sin(1.5t)k

**The cardioid:**

r_6(t) = cos(t)(1-cos(t))i + sin(t)(1-cos(t))j

## Importance of Vector Valued Functions in Machine Learning

Vector valued functions play an important role in machine learning algorithms. Being an extension of scalar valued functions, you would encounter them in tasks such as multi-class classification and multi-label problems. Kernel methods, an important area of machine learning, can involve computing vector valued functions, which can be later used in multi-task learning or transfer learning.

## Extensions

This section lists some ideas for extending the tutorial that you may wish to explore.

Integrating vector functions

Projectile motion

Arc length in space

Kernel methods for vector output

If you explore any of these extensions, I’d love to know. Post your findings in the comments below.

## Further Reading

This section provides more resources on the topic if you are looking to go deeper.

### Tutorials

A Gentle Introduction to Multivariate Calculus

Derivatives

### Resources

Additional resources on Calculus Books for Machine Learning

### Books

Thomas’ Calculus, 14th edition, 2017. (based on the original works of George B. Thomas, revised by Joel Hass, Christopher Heil, Maurice Weir)

Calculus, 3rd Edition, 2017. (Gilbert Strang)

Calculus, 8th edition, 2015. (James Stewart)

## Summary

In this tutorial, you discovered what vector functions are and how to differentiate them.

Specifically, you learned:

Definition of vector functions

Parametric curves

Differentiating vector functions

## Do you have any questions?

Ask your questions in the comments below and I will do my best to answer.

The post A Gentle Introduction To Vector Valued Functions appeared first on Machine Learning Mastery.

Read MoreMachine Learning Mastery