What Is Artificial Intelligence?
"AI" is used for everything from a chess program to a chatbot to a washing machine with a fuzzy-logic setting. Before you can say what machine learning is, it helps to pin down the larger field it belongs to.
A working definition
Artificial intelligence (AI) is the field of computer science that builds systems which perform tasks we would call intelligent if a person did them: perceiving, reasoning, planning, understanding language, making decisions under uncertainty, and learning.
A useful way to make this concrete is to think of an agent: a program that observes its environment (through data, sensors or text), decides what to do, and acts, in order to reach a goal. A route planner, a thermostat controller, a game opponent and a customer-service bot are all agents in this sense. The field asks how to make such agents act well.
The main approaches
AI is older than machine learning and much broader. Over the decades it has used several families of techniques, and real systems often combine them.
| Approach | Idea | Typical examples |
|---|---|---|
| Search and planning | explore the possible sequences of actions and pick a good one | route finding, puzzle solvers, game-tree search in chess |
| Knowledge and rules | people write facts and if-then rules; the program applies them | expert systems, business-rule engines, tax software |
| Logic and reasoning | derive new facts from known ones with formal inference | theorem provers, constraint solvers, scheduling |
| Probabilistic reasoning | represent uncertainty with probabilities and update beliefs | spam scoring with Bayes' rule, diagnosis networks, robot localisation |
| Machine learning | learn the behaviour from data instead of writing it | image recognition, recommendation, speech recognition, LLMs |
The first rows are sometimes called symbolic or "classic" AI: the intelligence is written down explicitly by people. Machine learning is the data-driven approach: the intelligence is extracted from examples.
AI without learning: search
A delivery robot in a warehouse must get from its start square to a goal square without driving through shelves. No data and no learning are needed: the program explores the map systematically. Breadth-first search visits the squares in rings of increasing distance from the start, so the first time it reaches the goal it has found a shortest route.
from collections import deque
# A tiny warehouse map: S start, G goal, # shelf. The robot may move up, down, left, right.
grid = [
"S..#....",
".#.#.##.",
".#...#..",
".####.#.",
"......#G",
]
rows, cols = len(grid), len(grid[0])
start, goal = (0, 0), (4, 7)
def neighbours(r, c):
for dr, dc in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
nr, nc = r + dr, c + dc
if 0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] != "#":
yield nr, nc
# Breadth-first search: explore the map in rings of equal distance from the start.
came_from = {start: None}
queue = deque([start])
while queue:
cell = queue.popleft()
if cell == goal:
break
for nxt in neighbours(*cell):
if nxt not in came_from:
came_from[nxt] = cell
queue.append(nxt)
path, cell = [], goal
while cell is not None:
path.append(cell)
cell = came_from[cell]
path.reverse()
print("cells explored:", len(came_from))
print("shortest path length:", len(path) - 1, "moves")
canvas = [list(row) for row in grid]
for r, c in path[1:-1]:
canvas[r][c] = "*"
print("\n".join("".join(row) for row in canvas))cells explored: 27
shortest path length: 15 moves
S**#****
.#*#*##*
.#***#.*
.####.#*
......#G
The robot "plans" a route of 15 moves, and the program is guaranteed to be correct for any map. This is intelligent behaviour, but nothing was learned: the method was written by a person and works because the problem is fully described (the map is known, the moves are exact).
AI without learning: rules
When experts can state their knowledge as rules, a program can apply them. This is the idea of expert systems, which were the dominant form of AI in the 1980s and still run inside many business systems.
# A rule-based "expert system": knowledge written by a person as if-then rules.
RULES = [
(lambda f: f["soil_moisture"] < 20 and not f["rain_forecast"], "water now"),
(lambda f: f["soil_moisture"] < 20 and f["rain_forecast"], "wait for the rain"),
(lambda f: f["soil_moisture"] > 70, "too wet: check drainage"),
]
def advise(facts):
for condition, action in RULES: # the first rule that fires wins
if condition(facts):
return action
return "no action"
for facts in [
{"soil_moisture": 12, "rain_forecast": False},
{"soil_moisture": 15, "rain_forecast": True},
{"soil_moisture": 45, "rain_forecast": False},
{"soil_moisture": 85, "rain_forecast": False},
]:
print(facts, "->", advise(facts)){'soil_moisture': 12, 'rain_forecast': False} -> water now
{'soil_moisture': 15, 'rain_forecast': True} -> wait for the rain
{'soil_moisture': 45, 'rain_forecast': False} -> no action
{'soil_moisture': 85, 'rain_forecast': False} -> too wet: check drainage
Rules are transparent and easy to audit. Their weakness shows when the knowledge is hard to put into words. Nobody can write down rules that recognise a cat in a photo or a word in a noisy recording: we do it effortlessly but cannot explain how. That is where learning from examples takes over, as the next lesson shows.
Narrow and general AI
Every AI system in use today is narrow: it performs one task, or a family of related tasks, within the conditions it was built or trained for. A chess engine cannot drive a car, and an image classifier trained on daytime photos may fail at night. Artificial general intelligence (AGI), a system as flexible as a person across tasks, is a research goal and a topic of debate, not an existing product. Large language models are broader than earlier systems, but they still fail in ways a person would not, which is why the ai-llm course spends a lesson on hallucinations.
A short history
| Period | What happened |
|---|---|
| 1950s | Turing asks whether machines can think; the term "artificial intelligence" is coined for the 1956 Dartmouth workshop; the first learning programs (a checkers player, the perceptron) |
| 1960s–1970s | search, logic and early language programs; optimism, then the first "AI winter" when promises outran results |
| 1980s | expert systems in industry; backpropagation popularised for training neural networks |
| 1990s–2000s | statistical machine learning: support vector machines, random forests, probabilistic models; chess engine beats the world champion (1997) |
| 2010s | deep learning wins at image recognition (2012), speech and translation; a program beats the top players at Go (2016); the transformer architecture (2017) |
| 2020s | large language models and generative AI reach millions of users |
The history lesson of the ai-llm course follows the language-model thread in more detail.
Common misconceptions
- "AI means machine learning." ML is the most successful part of AI today, but route planners, schedulers and rule engines are AI too, and they are often the right tool.
- "AI understands like a person." Systems map inputs to outputs according to their design or training. They can be very capable without sharing human understanding or common sense.
- "If it is called AI, it must be complex." A good if-then rule written by an expert can outperform a learned model when data is scarce and the rule is known.
Practice
- Classify each system as mainly search/planning, rules, probabilistic reasoning or machine learning: (a) a GPS route planner, (b) an email filter that estimates the probability of spam from word counts it learned, (c) a payroll program applying tax brackets, (d) a phone keyboard that predicts your next word from millions of typed sentences.
Answer
(a) search and planning; (b) machine learning with probabilistic reasoning (for example naive Bayes, which learns word probabilities from labelled emails); (c) rules, since tax brackets are written law; (d) machine learning, since the predictions are learned from text.
- In the search example, block the square at row 2, column 2 by changing
.#...#..to.##..#... Is there still a path? What does the program do, and how would you make it report the result properly?
Answer
There is no path any more. The only way to the right half of the map went through row 2, column 2; the bottom row is a dead end because of the shelf next to the goal and the shelf above row 3, column 5. The search explores every reachable square without meeting the goal, so came_from has no entry for (4, 7) and the path reconstruction stops with KeyError: (4, 7). Check if goal not in came_from: print("no route") before rebuilding the path. Search is exact: it either finds a shortest route or proves that none exists.
Test yourself
Which statement best describes the relationship between AI and machine learning?
- They are two names for the same thing
- Machine learning is one approach within AI
- AI is one approach within machine learning
- They are unrelated fields
The breadth-first search example finds a shortest route. Why is it AI without learning?
- It uses no data and the method is written by a person
- It is too simple to be AI
- It learns the map as it goes
- It needs labelled examples
When do hand-written rules struggle most?
- When the knowledge is easy to state
- When experts cannot put the knowledge into explicit rules, as in recognising faces
- When the rules must be audited
- When the program must be fast
What does 'narrow AI' mean?
- AI that runs on small devices
- A system that performs a specific task within the conditions it was built or trained for
- AI with a small number of parameters
- AI that only uses rules