# Function

A function takes input and produces output. The idea is a useful way to abstract away complexity and, especially in the age of computers, is a practical tool to solve problems. Often in applied mathematics a person only needs to understand what a function does, not how it does it.

## Basic Function

The simplest function in mathematics is a function that takes in a number as input and returns a number as output. This is often visualized using a graph of the cartesian coordinate system where the x-axis represents input and the y-axis represents output.

For example, let’s take a function that returns the double of the input. The input and output is represented in the table below. The input is shown in the left column, labeled as x, and the output is shown in the right column, labeled as y.

x y
1 2
2 4
3 6

The implementation of the function is shown below. The function takes in x as a number and returns the result of multiplying 2 by x.

This is visualized by the graph below.