Skip to content
Zogle

← Articles

Experiment

What Is a Neuron? Trying 7 Kinds on 3 Tiny Puzzles

We tried 7 kinds of neuron on AND, OR and XOR. The kind of neuron barely mattered. Using more than one neuron is what solved XOR.

By Shashank R AlurUpdated 6 min read

On this page

Abstract

A neuron is a tiny calculator. Numbers go in, it adds them up with weights, and one number comes out. We tried 7 kinds on three tiny puzzles (AND, OR, XOR). The kind didn't matter much. What mattered was having more than one neuron working together.

Research question

Does the kind of neuron change what it can learn, or does only the number of neurons matter?

Hypothesis

  1. Every single neuron will solve AND and OR.
  2. Every single neuron will fail XOR.
  3. Two or more neurons together will fix XOR.

Why this matters

"Neuron" sounds complicated, but it isn't. Putting 7 kinds side by side on the same puzzles shows what changes between simple and advanced, and what doesn't.

Experimental setup

What a neuron does:

  1. Multiply each input by its own weight.
  2. Add everything up, plus one extra number called the bias.
  3. Optionally, pass the total through a "squash" step.

The 7 kinds differ only in step 3.

#KindSquash step
1Step1 if total > 0, else 0
2LinearNothing, passes the total through
3SigmoidSqueezes into 0 to 1
4TanhSqueezes into -1 to 1
5ReLUKeeps positives, negatives become 0
6Group of 22 tanh neurons feed 1 sigmoid neuron
7Group of 44 tanh neurons feed 1 sigmoid neuron

The three puzzles (two inputs, each 0 or 1):

InputsANDORXOR
0, 0000
0, 1011
1, 0011
1, 1110

Why one neuron can't do XOR. Draw the 4 inputs as points on a grid. Mark the points whose answer is 1 with ●, and the points whose answer is 0 with ○.

text
AND               OR                XOR
x2                x2                x2
1 ○  ●            1 ●  ●            1 ●  ○
0 ○  ○            0 ○  ●            0 ○  ●
  0  1  x1          0  1  x1          0  1  x1

For AND and OR, one straight line can put the ● on one side and the ○ on the other. For XOR, the ● sit on opposite corners, so no single straight line can split them. One neuron draws one line, which is why it fails.

Settings:

  • Kinds 2 to 5: learning speed 0.5, 2000 rounds
  • Kind 1 (step): speed 0.1, 200 rounds
  • Kinds 6 and 7: speed 0.5, 5000 rounds
  • Random starting weights, with 10 different starts per kind per puzzle
  • "Solved" means all 4 answers are right

Method

Plain numpy. Every round, each neuron nudges its weights a little to make its mistakes smaller.

python
import numpy as np
X = np.array([[0,0],[0,1],[1,0],[1,1.]])
tasks = {"AND": np.array([0,0,0,1.]),
         "OR":  np.array([0,1,1,1.]),
         "XOR": np.array([0,1,1,0.])}
sig = lambda z: 1/(1+np.exp(-z))

acts = {  # (squash, how fast it changes)
 "linear":  (lambda z: z,              lambda z,o: np.ones_like(z)),
 "sigmoid": (sig,                      lambda z,o: o*(1-o)),
 "tanh":    (np.tanh,                  lambda z,o: 1-o**2),
 "relu":    (lambda z: np.maximum(z,0),lambda z,o: (z>0)*1.),
}

def single(act, t, seed, lr=0.5, ep=2000):
    r = np.random.default_rng(seed); w = r.normal(0,1,2); b = 0.
    f, df = acts[act]
    for _ in range(ep):
        z = X@w + b; o = f(z); g = 2*(o-t)/4*df(z,o)
        w -= lr*X.T@g; b -= lr*g.sum()
    return np.mean((f(X@w+b) > 0.5) == t)

def step(t, seed, lr=0.1, ep=200):
    r = np.random.default_rng(seed); w = r.normal(0,1,2); b = 0.
    for _ in range(ep):
        for x, y in zip(X, t):
            o = float(x@w + b > 0)
            w += lr*(y-o)*x; b += lr*(y-o)
    return np.mean((((X@w+b) > 0)*1.) == t)

def group(h, t, seed, lr=0.5, ep=5000):
    r = np.random.default_rng(seed)
    W1 = r.normal(0,1,(2,h)); b1 = np.zeros(h)
    W2 = r.normal(0,1,(h,1)); b2 = 0.
    for _ in range(ep):
        a = np.tanh(X@W1+b1); o = sig(a@W2+b2)[:,0]
        g2 = (2*(o-t)/4*o*(1-o))[:,None]
        g1 = (g2@W2.T)*(1-a**2)
        W2 -= lr*a.T@g2; b2 -= lr*g2.sum()
        W1 -= lr*X.T@g1; b1 -= lr*g1.sum(0)
    o = sig(np.tanh(X@W1+b1)@W2+b2)[:,0]
    return np.mean((o > 0.5) == t)

def report(name, fn):
    out = [sum(fn(t,s)==1 for s in range(10)) for t in tasks.values()]
    print(f"{name:18s} AND {out[0]}/10  OR {out[1]}/10  XOR {out[2]}/10")

report("step", lambda t,s: step(t,s))
for a in acts: report(a, lambda t,s,a=a: single(a,t,s))
report("group of 2", lambda t,s: group(2,t,s))
report("group of 4", lambda t,s: group(4,t,s))

Results

How many of the 10 random starts got all 4 answers right:

KindANDORXOR
1. Step10/1010/100/10
2. Linear10/1010/100/10
3. Sigmoid10/1010/100/10
4. Tanh10/1010/100/10
5. ReLU3/105/100/10
6. Group of 210/1010/107/10
7. Group of 410/1010/109/10

Analysis

  • Kinds 1 to 4 behaved the same. All solved AND and OR every time, and none ever solved XOR. Changing the squash step gave no new power.
  • XOR only became solvable with a group. 2 neurons got it 7 times out of 10, and 4 neurons got it 9 times out of 10.
  • So the jump from simple to advanced is not a fancier single neuron. It's using several neurons together.

What we learned

  • One neuron draws one straight line. That's enough for AND and OR, but not for XOR.
  • The squash step matters for other reasons (output range, smooth learning), but it doesn't make one neuron smarter.
  • Several neurons together can do what one can't.

Limitations

  • Only 4 data points and 3 puzzles. Real problems are much bigger.
  • One learning speed and one round count per kind. Other settings could change the scores.
  • 10 starts is a small sample, so 7/10 vs 9/10 is a hint, not proof.
  • Only 7 kinds tested. Real networks use many more.

Failures and surprises

ReLU did worst of the single neurons: only 3/10 on AND and 5/10 on OR. We didn't check why. A likely reason is that in some starts the total is negative for every input, so ReLU outputs 0 every time and stops learning. That's a guess until we test it.

Next question

Why did ReLU fail in some starts? Print its total for each input at the start of every failed run and check whether it was stuck at 0 (EXP-007).

References

  • Rosenblatt (1958). The perceptron: a probabilistic model for information storage and organization in the brain. Psychological Review 65(6).
  • Rumelhart, Hinton, Williams (1986). Learning representations by back-propagating errors. Nature 323, 533-536.

Tags: neuron, neural network basics, step, sigmoid, tanh, relu, hidden layer, XOR

Written by

Shashank R Alur

AI engineer exploring the foundations of machine learning, language models, and high-performance AI systems.

Cite this article

Shashank R Alur. "What Is a Neuron? Trying 7 Kinds on 3 Tiny Puzzles." Zogle, Oct 2026. https://zogle.org/experiments/what-is-a-neuron-trying-7-kinds-on-3-tiny-puzzles

@article{alur2026what,
  author = {Shashank R Alur},
  title = {What Is a Neuron? Trying 7 Kinds on 3 Tiny Puzzles},
  journal = {Zogle},
  year = {2026},
  url = {https://zogle.org/experiments/what-is-a-neuron-trying-7-kinds-on-3-tiny-puzzles}
}

Keep reading