Introduction
In our previous lesson, we derived the Perceptron learning algorithm and established its core mechanism as a linear classifier. We concluded with the Perceptron Convergence Theorem, which guarantees that the algorithm finds a solution only if the data is linearly separable. This "if" is a crucial limitation.
This lesson directly addresses that limitation. Our goal is to explain the limitations of the Perceptron and how Multi-Layer Perceptrons (MLPs) overcome them. We will use the classic XOR problem to demonstrate why a single Perceptron fails. Then, we will introduce the architecture of the Multi-Layer Perceptron and explore, both mathematically and intuitively, how adding a "hidden layer" with non-linear activation functions empowers the network to solve complex, non-linear problems. This foundational concept is the bridge between the simple Perceptron and modern deep learning.
1. The Perceptron's Achilles' Heel: The XOR Problem
A single-layer Perceptron works by creating a single linear decision boundary—a line in 2D, a plane in 3D, or a hyperplane in higher dimensions. This works perfectly for problems that are linearly separable, meaning the different classes can be separated by one such hyperplane.
The classic example of a problem that is not linearly separable is the XOR (exclusive OR) function.
To understand precisely why the Perceptron fails here, let's dive into a detailed explanation.
Limitations of Single-Layer Perceptrons
The following article, 'Limitations of Single-Layer Perceptrons' from ApX Machine Learning, provides an excellent and concise explanation of this core limitation. It covers the visual intuition and, importantly for us, the mathematical proof of why the XOR problem is unsolvable for a single Perceptron.
Please read the text from the beginning down to the section 'Moving Past Linear Boundaries'. Pay close attention to two key parts: The visualization of the XOR points on a 2D graph. The step-by-step mathematical proof using inequalities, which shows that no weights and bias can simultaneously satisfy the conditions for XOR.
As the reading demonstrates, no single line can separate the (0,1) and (1,0) inputs (which should be class 1) from the (0,0) and (1,1) inputs (which should be class 0). The mathematical proof solidifies this by showing that the constraints imposed by the four XOR data points lead to a logical contradiction.

This inability to handle non-linear relationships was a major criticism of early neural network models and a primary motivation for developing more sophisticated architectures.
2. The Solution: Stacking Layers to Form a Multi-Layer Perceptron (MLP)
If one Perceptron creates one line, what if we could combine multiple lines to create more complex decision boundaries? This is the core idea behind the Multi-Layer Perceptron (MLP).
An MLP consists of:
- An Input Layer, which receives the raw data features.
- One or more Hidden Layers, which are not directly connected to the input or output. These are the workhorses of the network.
- An Output Layer, which produces the final prediction.
A crucial element, which you might recall from our previous lesson, is the non-linear activation function (e.g., the Sigmoid function, ReLU). If we were to only use linear activation functions (or no activation function), stacking multiple layers would be mathematically equivalent to a single layer. The non-linearity is what allows each layer to learn progressively more complex features from the output of the previous layer.
3. How MLPs Create Non-Linear Boundaries
The magic of the MLP lies in what the hidden layer does. Instead of trying to separate the data in the original input space, the hidden layer transforms the input data into a new representation space. In this new space, the problem becomes linearly separable. The output layer is then simply a linear classifier (like a Perceptron) that operates on this transformed, separable data.
Let's watch a video that provides a beautiful visual intuition for this process.
What happens *inside* a neural network?
This video from vcubingx, 'What happens inside a neural network?', wonderfully visualizes how an MLP can tackle a non-linearly separable problem by transforming the data.
Please watch from 01:17 to 01:43, and then from 06:15 to 07:49. The first short clip introduces the idea of layering neurons. The second, longer clip provides the key visualization: notice how the network morphs the spiral dataset into clusters that can be separated by straight lines.
The video shows that the network learns to "un-twist" the complicated data. The hidden layers perform a non-linear mapping that sends the input data into a new feature space where the classes are cleanly separated. The final layer then has the simple job of drawing a line to separate these new, well-behaved clusters.
4. Solving the XOR Problem with an MLP: A Concrete Example
Let's make this tangible by constructing an MLP that solves the XOR problem. We will use a network with 2 input neurons, 2 hidden neurons, and 1 output neuron.
The following video walks through this example in detail, showing the exact weights and calculations needed.
Neural Networks 6: solving XOR with a hidden layer
In 'Neural Networks 6: solving XOR with a hidden layer,' Victor Lavrenko provides a step-by-step calculation showing how an MLP correctly classifies all four points of the XOR problem.
Watch the video from the beginning up to 05:54. As you watch, try to follow the calculations for at least one of the inputs (e.g., (1,0)) through the network. Pay attention to: The specific weights and biases used. The activation values of the two hidden neurons. How the final output neuron combines the hidden neuron activations to produce the correct XOR output. The final explanation of the geometric interpretation: each hidden neuron creates a hyperplane, and the output neuron learns to combine the regions defined by these hyperplanes.
Let's summarize the key insight from the video.
The first hidden neuron, , can be trained to learn the OR function. Its decision boundary separates (0,0) from the rest.
The second hidden neuron, , can be trained to learn the NAND (NOT AND) function. Its boundary separates (1,1) from the rest.
The hidden layer's output for each input is:
input(0,0)->hidden(0,1)input(0,1)->hidden(1,1)input(1,0)->hidden(1,1)input(1,1)->hidden(1,0)
Look at this new representation in the hidden space! The original inputs (0,1) and (1,0) that should be class 1 are now both mapped to (1,1). The original inputs (0,0) and (1,1) that should be class 0 are now mapped to (0,1) and (1,0). In this new 2D space defined by the hidden neurons' activations, the problem is now linearly separable. The output neuron can easily learn an AND function that says "output 1 only if the input from the hidden layer is (1,1)".

Conclusion
In this lesson, we have confronted the fundamental limitation of the Perceptron and introduced its powerful successor, the Multi-Layer Perceptron.
Key Takeaways:
- A single-layer Perceptron can only solve linearly separable problems because its decision boundary is a single hyperplane.
- The XOR problem is the canonical example of a non-linearly separable problem that a Perceptron cannot solve.
- Multi-Layer Perceptrons (MLPs) overcome this limitation by introducing one or more hidden layers with non-linear activation functions.
- The hidden layers learn to transform the input data into a new, higher-dimensional representation where the data becomes linearly separable. The output layer then acts as a simple linear classifier on this transformed data.
Preview of the Next Lesson
We have now manually constructed an MLP with specific weights and biases to solve the XOR problem. This demonstrates that a solution exists. But this raises the most important question: how can a network learn these weights and biases automatically from data?
The intuitive update rule we used for the single Perceptron won't work, because we don't have "correct" labels for the hidden neurons. The next lesson will tackle this challenge head-on as we derive the backpropagation algorithm, the engine that drives the training of almost all modern neural networks. This derivation, which relies heavily on the chain rule from calculus, will be a cornerstone of our course.