Home/Learn/Math for AI/Functions, Graphs & Coordinate Geometry

Functions, Graphs & Coordinate Geometry

Beginner
High-School Refresher

A function is a machine that maps inputs to outputs; a graph is its picture — and a neural network is just a very large, learnable function.

Overview

Before any AI math, get comfortable with the single most important object in the field: the function. f(x) = 2x + 1 takes an input and returns an output; its graph is a straight line whose slope (2) and intercept (1) you can read off directly. This matters because a machine-learning model IS a function — a huge one with millions of tunable numbers — and "training" means adjusting those numbers so the function's graph passes through your data. Slope and intercept reappear as "weight" and "bias", the two quantities every linear layer learns. Coordinate geometry (points, distance, lines in 2D) is the ground on which vectors and higher-dimensional spaces are built, so a firm picture here pays off everywhere later.

A line: slope and intercept = weight and bias

The equation of a line, y = wx + b, is the atom of machine learning. w (slope/weight) controls steepness; b (intercept/bias) shifts it up or down. A single neuron computes exactly this before its activation.

y = wx + b — one line, two learnable numbers
import numpy as np

w, b = 2.0, 1.0                 # weight (slope), bias (intercept)
x = np.linspace(-3, 3, 7)       # inputs: -3, -2, ... 3
y = w * x + b                   # the line / a linear neuron
print(y)   # [-5. -3. -1.  1.  3.  5.  7.]

# Change w -> steeper line; change b -> whole line moves up/down.
# Training a model = searching for the w and b that fit the data.

Non-linear functions and why AI needs them

Straight lines alone can only model straight relationships. Real data curves, so neural networks apply non-linear functions (like ReLU or the sigmoid) between linear steps. Picture their graphs — a bend or an S-curve — and you understand why stacking them lets a network fit almost any shape.

Non-linearities give models their expressive power
import numpy as np

x = np.linspace(-6, 6, 5)
relu    = np.maximum(0, x)          # bends at 0: flat then rising
sigmoid = 1 / (1 + np.exp(-x))      # smooth S-curve squashing to (0,1)

print("relu   ", relu)      # [0. 0. 0. 3. 6.]
print("sigmoid", np.round(sigmoid, 3))  # [0.002 0.047 0.5 0.953 0.998]

Key Points to Remember

  • 1A function maps inputs to outputs; its graph is that mapping drawn out
  • 2y = wx + b: slope=weight, intercept=bias — the core of a linear layer
  • 3Non-linear functions (ReLU, sigmoid) let networks fit curved data
  • 4Reading a graph = predicting a function's behaviour without computing every point

Interview Questions

Sign in to ask Aria
1

What do the slope and intercept of a line correspond to in a neural network?

EasyInfosys
2

Why can a network of only linear layers never model a curved relationship?

MediumAmazon
3

Sketch the sigmoid function and describe its output range and shape.

EasyStartup

Ask Aria about Functions, Graphs & Coordinate Geometry

Your personal AI tutor — ask anything about this concept

Revision Status

Personal Notes

Sign in to save personal notes for this topic.

Discussion

Sign in to join the discussion.

Loading discussion…