This is Lesson 1 of 8 from AI For Youth: Grade 11, shown exactly as subscribers see it. No account is needed to read it. Subscribers get every lesson, the graded quizzes, the project, progress tracking, and a certificate of completion.
Get accessYour child already lives in a world full of AI, and that will be true for the rest of their life. The good news is that understanding it is well within reach. This course explains how AI really works at your child’s grade level, one clear lesson at a time, so they can use it with confidence and know when to double-check it. The first lesson is below. Read it together and see if it fits.
This lesson introduces the artificial neuron, the unit from which every network in this course is built. It covers the arithmetic a neuron performs on its inputs, the geometric meaning of its weights and bias, the perceptron rule that sets those numbers from examples, and the one kind of problem a single neuron can never solve.
By the end of this lesson you can
- Write down what a neuron computes from its inputs, weights, bias and activation function, and say what each part contributes.
- Explain what the weights and the bias mean geometrically, and describe the boundary a single neuron draws.
- Carry out one step of the perceptron update rule by hand and explain why it moves the boundary in the right direction.
- State precisely what a single neuron cannot do, and give the standard example.
The neuron as a weighted sum
A neuron is a unit that multiplies each of its inputs by a weight, adds the products together with a bias, and passes the total through an activation function to produce one output.
Each part of that sentence names a quantity, and each one is defined below in the order it is used.
Inputs are the numbers a neuron receives. In this course inputs are always written as numbers, even when the underlying fact is a yes or a no. A yes-or-no input is coded as 1 for yes and 0 for no.
Consider a machine that decides whether an afternoon is suitable for going outside. It receives three inputs: the temperature, whether it is raining (1 for raining, 0 for not), and the wind speed.
A weight is a number attached to one input. It records two things at once: how much that input matters, and in which direction it pushes the answer.
A large positive weight on temperature means warmth pushes the answer toward yes. A large negative weight on rain means rain pushes the answer toward no. A weight near zero means that input is being ignored.
The bias is one extra number that belongs to no input. It is added to the weighted sum and sets how much total evidence is needed before the answer tips from one side to the other.
A large negative bias makes the neuron hard to convince. A positive bias makes it easy to convince.
The activation function is the rule that turns the single total into the output. The simplest activation function is the step: output 1 if the total is greater than zero, and 0 otherwise.
The full computation, written in words, is: multiply each input by its weight, add the products, add the bias, and apply the activation function to the result. Written as a formula with three inputs:
output = 1 if total > 0, otherwise 0
Worked example. Let the weights be 0.8 for temperature, −2.0 for rain and −0.3 for wind, with a bias of −0.1. Temperature and wind are given on a scale from 0 to 1. Take a warm day (0.9), no rain (0), light wind (0.2):
= 0.72 + 0 − 0.06 − 0.1 = 0.56 → above zero → output 1 (go outside)
Now the same day, except that it is raining, so the rain input becomes 1:
= 0.72 − 2.0 − 0.06 − 0.1 = −1.44 → below zero → output 0 (stay in)
Changing the rain input alone reversed the decision, because the weight on rain is large and negative compared with the other two weights. Every step of the calculation is multiplication, addition and a comparison with zero. The only open question is where the four numbers (three weights and a bias) came from, and that question occupies the rest of the course.
Try it
- Using the same weights (0.8, −2.0, −0.3) and bias (−0.1), compute the output for a cool day with temperature 0.3, no rain and wind 0.5.
- Keep the inputs of the first worked example (0.9, 0, 0.2) but change the bias to −0.7. What is the total, and what is the output?
Answers
1. (0.8 × 0.3) + (−2.0 × 0) + (−0.3 × 0.5) + (−0.1) = 0.24 + 0 − 0.15 − 0.1 = −0.01. Below zero, so the output is 0 (stay in).
2. 0.72 + 0 − 0.06 − 0.7 = −0.04. Below zero, so the output is 0. A more negative bias made the neuron harder to convince, and the same warm day no longer passes.
The decision boundary
With two inputs the neuron can be drawn on paper. The neuron outputs 1 when the weighted sum plus bias is greater than zero and 0 when it is less. The border between the two answers is the set of points where the total is exactly zero.
The decision boundary of a neuron is the set of input points where its total equals zero. With two inputs it is the set of points satisfying w1·x1 + w2·x2 + b = 0, which is the equation of a straight line.
A neuron with two inputs therefore divides the plane into two halves with a straight line and answers every question by reporting which side of the line the input falls on.
The weights and the bias do different jobs on that line.
- The weights control the orientation of the line, which way it tilts. Change a weight and the line pivots.
- The bias controls the position of the line. Change the bias and the line slides back and forth without rotating.
Training a single neuron is choosing where to put a line.
With three inputs the boundary is a flat plane cutting through three-dimensional space. With a thousand inputs it is a flat divide through thousand-dimensional space, which nobody can picture and which the algebra handles without difficulty.
A hyperplane is the general name for a flat boundary in any number of dimensions: a line in two dimensions, a plane in three, and the equivalent flat object beyond that. The one property to carry forward is that a hyperplane is always flat.
The total also carries information beyond its sign. Its size measures roughly how far the input point sits from the boundary. A point far inside the yes region produces a large positive total; a point barely on the yes side produces a total close to zero. The neuron is therefore reporting something like confidence, and the examples it is least sure about are the ones nearest the boundary.
Try it
- A neuron has weights w1 = 1, w2 = 1 and bias b = −1. Write the equation of its boundary and say which side the point (0, 0) is on.
- The bias is changed from −1 to −2 and the weights are left alone. Does the boundary rotate, slide, or both?
Answers
1. The boundary is x1 + x2 − 1 = 0. At (0, 0) the total is −1, which is below zero, so (0, 0) is on the output-0 side.
2. It slides only. The weights set the orientation, and they did not change.
The perceptron update rule
The weights are not set by hand. In 1958 Frank Rosenblatt published a procedure that sets them from examples. The procedure shows the neuron one labeled example at a time. If the neuron gives the right answer, nothing changes. If it gives the wrong answer, the weights are nudged.
The perceptron update rule is the nudge. Write the true label as y and the neuron’s output as ŷ. For each weight, add a small step in the direction of the input, scaled by the error (y − ŷ). The bias receives the same step without the input factor.
b ← b + η (y − ŷ)
The learning rate, written with the Greek letter η, is a small positive number that controls how big each nudge is. It appears in every lesson from here on.
The rule moves the boundary the right way for the following reason. Suppose the true answer was 1 and the neuron said 0. Then (y − ŷ) is +1, and a positive multiple of the input is added to the weights. That makes the weighted sum for this particular input larger next time, which pushes the total up toward positive, which is the answer that was wanted. When the error runs the other way, (y − ŷ) is −1 and everything happens in reverse. The rule contains no further cleverness: it leans in the direction of the answer it should have given.
Worked example. Start with both weights and the bias at zero, and set the learning rate to 0.5. The first example is x = (2, 1) with true label y = 1.
w1 ← 0 + 0.5 × 1 × 2 = 1.0
w2 ← 0 + 0.5 × 1 × 1 = 0.5
b ← 0 + 0.5 × 1 = 0.5
recheck: (1.0 × 2) + (0.5 × 1) + 0.5 = 3.0 → output 1 → correct
The full procedure repeats this over the whole set of examples, again and again, so that the line pivots and slides until no example is left on the wrong side.
- Take the next labeled example.
- Compute the neuron’s output.
- If the output matches the label, change nothing.
- If it does not, apply the update rule to every weight and to the bias.
- Continue through the examples, and repeat the whole pass until a full pass makes no mistakes.
Linearly separable data is data whose two classes can be split by a single straight boundary. For linearly separable data the perceptron procedure is guaranteed to finish with every example on the correct side. This guarantee is one of the reasons the perceptron caused such excitement at the time.
The shape of the rule matters more than the formula. In Lesson 05 you will meet gradient descent, which does the same thing in a more general way: instead of reacting to a right-or-wrong verdict, it measures how wrong the answer was and steps downhill accordingly. That generalization is what makes training more than one layer possible.
Try it
- Continue the worked example. The weights are now w = (1.0, 0.5) and b = 0.5, with learning rate 0.5. The next example is x = (1, 1) with true label y = 0. Compute the output, decide whether an update is needed, and if so give the new weights and bias.
- Suppose the true label is 0 and the neuron outputs 1. What is the sign of (y − ŷ), and does the weighted sum for that input get larger or smaller after the update?
Answers
1. total = (1.0 × 1) + (0.5 × 1) + 0.5 = 2.0, so the output is 1, but y = 0: wrong. (y − ŷ) = −1. New values: w1 = 1.0 + 0.5 × (−1) × 1 = 0.5; w2 = 0.5 + 0.5 × (−1) × 1 = 0; b = 0.5 + 0.5 × (−1) = 0. Recheck on (1, 1): 0.5 + 0 + 0 = 0.5, still output 1, so this example would be corrected again on a later pass.
2. (y − ŷ) = 0 − 1 = −1. A negative multiple of the input is added, so the weighted sum for that input gets smaller, pushing the total toward the 0 side.
The limit of a single neuron: XOR
Everything a single neuron can learn has the form “yes on one side of a straight divide, no on the other.” This limitation cannot be trained away, because it is built into the arithmetic of Section 02. It rules out a problem that is very small.
XOR (exclusive or) is the function of two inputs, each either 0 or 1, that outputs 1 when the two inputs differ and 0 when they match.
(0, 1) → 1 (1, 0) → 1
Plot the four points on paper and mark their outputs. The two zeros sit at opposite corners of the unit square, and so do the two ones. No single straight line can be drawn with both ones on one side and both zeros on the other. Try it for a minute; the attempt is the point. There is no such line, and therefore no choice of two weights and a bias produces one. XOR is not linearly separable.
XOR is small, but it is the smallest example of a very common situation: the categories of interest are not on opposite sides of any flat divide. Most problems worth solving look like this, which is why the limitation mattered so much. When Marvin Minsky and Seymour Papert laid it out in 1969, work on neural networks slowed for more than a decade. The field had the neuron and did not yet have a way to train more than one layer of them.
Be precise about what the limitation is, because this is the most common misunderstanding. It concerns the shape of the boundary, not the number of inputs. A neuron with a thousand inputs still draws one perfectly flat boundary through thousand-dimensional space. More inputs do not produce a bend.
The fix is therefore not a bigger neuron but more than one. In Lesson 02 you will see that two neurons, each drawing its own line, feeding a third that combines their two answers, separate XOR without difficulty.
A hidden layer is a set of neurons that sit between the inputs and the output, receiving the inputs and passing their own outputs onward. The two neurons in the middle of the XOR solution are a hidden layer, and once a network has one, the flatness limitation is gone.
Try it
- AND outputs 1 only when both inputs are 1. Give weights and a bias for a single neuron that computes AND with the step activation, and check all four inputs.
- A classmate claims that XOR could be solved by a single neuron if it were given a third input. Say why this is not the right fix.
Answers
1. One choice: w1 = 1, w2 = 1, b = −1.5. Totals: (0,0) → −1.5 → 0; (0,1) → −0.5 → 0; (1,0) → −0.5 → 0; (1,1) → 0.5 → 1. The line x1 + x2 = 1.5 cuts off the top-right corner only. AND is linearly separable.
2. Adding an input raises the dimension but the boundary stays flat. The problem with XOR is the shape of the boundary, not how many inputs there are. The fix is a hidden layer, which lets several flat boundaries be combined.
Summary
- A neuron multiplies each input by a weight, adds the products and a bias, and applies an activation function. With the step activation, the output is 1 when the total is above zero and 0 otherwise.
- With weights 0.8, −2.0, −0.3 and bias −0.1, the inputs (0.9, 0, 0.2) give a total of 0.56 and output 1; changing the rain input to 1 gives −1.44 and output 0.
- The decision boundary is where the total equals zero. With two inputs it is a straight line; in general it is a hyperplane, always flat. Weights set its orientation; the bias slides it.
- The perceptron update rule adds η(y − ŷ)x to each weight and η(y − ŷ) to the bias after a mistake. Starting from zero with η = 0.5 on x = (2, 1), y = 1, one update gives w = (1.0, 0.5), b = 0.5, and the rechecked total is 3.0. For linearly separable data the procedure is guaranteed to finish.
- XOR cannot be separated by any single straight boundary, so no single neuron can learn it, no matter how many inputs it has. The fix is a hidden layer (Lesson 02); the more general training method is gradient descent (Lesson 05).
Key terms
- Neuron — a unit that computes a weighted sum plus bias and applies an activation function.
- Input — a number fed into a neuron; yes-or-no facts are coded as 1 or 0.
- Weight — the number attached to an input, setting its importance and direction.
- Bias — an extra number added to the weighted sum that sets the threshold.
- Activation function — the rule that turns the total into the output; the step outputs 1 above zero.
- Decision boundary — the set of inputs where the total is exactly zero.
- Hyperplane — a flat boundary in any number of dimensions.
- Perceptron update rule — w ← w + η(y − ŷ)x after a mistake.
- Learning rate (η) — the small positive number that scales each update.
- Linearly separable — data whose classes a single straight boundary can split.
- XOR — outputs 1 when two binary inputs differ; not linearly separable.
- Hidden layer — neurons between the inputs and the output.
Check your understanding
5 questions · 70% to pass · retakes encouraged
In the full course the graded quiz comes next and your progress is saved. Get access to continue.
Want the next free lesson by email? We post new free lessons and short tips for guiding your child with AI.
A short note when new free lessons are posted, plus occasional tips. No spam. Unsubscribe any time.That is the whole first lesson. The full AI For Youth: Grade 11 course has 8 lessons, 8 quizzes, and a project. One subscription unlocks every course, kindergarten through grade 12, plus AI Fundamentals for general audiences.
Get access