Mathematics on the Nile: Egyptian Fractions in MATLAB
Summary
This project explores the ancient Egyptian method of representing rational numbers as sums of distinct unit fractions, a practice dating back over 3,500 years. Using historical sources such as the Rhind Mathematical Papyrus, we examine how Egyptian scribes decomposed fractions such as 5/6 into unit fractions (or 2/3) without the use of modern notation or algorithms.
To bring this historical method to life, we implement a MATLAB program based on the greedy algorithm—an intuitive approach that selects the largest possible unit fraction at each step until the original fraction is fully decomposed. The project includes examples, visualizations, and comparisons to historical tables, offering both mathematical and computational insight into how early civilizations approached arithmetic.
By combining the history of mathematics with modern coding tools, this project highlights the ingenuity of ancient numerical systems and the continued relevance of these ideas in number theory and algorithmic thinking today.
Learning Goals
By completing this activity, students will understand the historical context of mathematics in Ancient Egypt, particularly how fractions were represented using unit fractions, learn how mathematical ideas evolve over time, and how historical algorithms inform modern mathematical thinking, gain exposure to the Rhind Mathematical Papyrus and the mathematical practices of early civilizations, and recognize the contrast between ancient and modern fraction notation and computation, reinforcing foundational understanding of rational numbers.
Students will use MATLAB to implement the Egyptian fraction decomposition algorithm, write and execute code that performs step-by-step arithmetic operations that mimic historical procedures, and visualize the decomposition process, such as by plotting unit fractions to show how they build up a whole.
MATLAB improves student learning by reinforcing algorithmic thinking by translating historical math into modern code, enhancing understanding of decomposition and approximation through experimentation, offering immediate feedback, helping students debug and refine their reasoning, and encouraging active learning by making abstract historical ideas concrete and interactive.
This activity cultivates several higher-order cognitive skills. Students translate mathematical procedures into programmable steps. Students analyze how and why different algorithms behave differently. Students synthesize by combining history, theory, and coding, students form connections across disciplines. Students either implement a known algorithm or explore variants to optimize or replicate historical results. Students comparing outputs, checking correctness, and identifying inefficiencies in methods reinforces careful analysis.
Through writing a report or giving a presentation, students articulate historical background, explain algorithms, and interpret results. Students may investigate historical sources, such as the Rhind Papyrus, and translate qualitative information into mathematical insight. If presented as a group project or final report, students practice explaining both technical and historical elements to an audience. If assigned as group work, students can practice dividing tasks, sharing insights, and integrating work across disciplines.
Context for Use
This project is designed for undergraduate students in a History of Mathematics course, ideally at the sophomore or junior level, though it can be adapted for more advanced high school students or introductory-level college math courses. The activity is most appropriate for small to medium-sized classes (approximately 10 to 20 students) at liberal arts colleges, community colleges, or universities where interdisciplinary and project-based learning is encouraged.
This is a longer-term project, not a single classroom or lab session. It works well as a capstone assignment, a unit project, or a final paper/presentation. The expected timeframe for completion is approximately two weeks, including research, coding, analysis, and reflection.
The project is flexible and can be assigned as an individual or small group project, in courses taught in-person, hybrid, or fully online. This is highly adaptable, as instructors can simplify the coding aspect for students with less programming experience or expand the mathematical depth for more advanced learners.
To complete this activity, students should have basic proficiency with MATLAB, including writing and running simple scripts and functions, using loops and conditional statements, working with arrays and basic mathematical operations, and basic plotting. No advanced MATLAB skills are required, making this an accessible introduction to algorithmic thinking through a historical lens.
Students should be comfortable with basic fraction arithmetic, an understanding of rational numbers, and some exposure to historical mathematical texts or mathematical history themes. No prior knowledge of number theory or ancient Egyptian mathematics is required, though basic research skills are helpful.
This project is well-suited for placement after introductory units on early number systems or historical numeration, in modules covering mathematical algorithms or pre-modern problem-solving methods, or as a bridge between theoretical concepts and computational applications.
For general math courses, the historical content can be minimized to focus on the algorithm and numerical thinking. In computer science or programming courses, the emphasis can be placed on algorithm implementation, using the historical background as a case study. In education programs, this activity can be used to explore non-Western mathematical traditions and pedagogical innovation in early civilizations.
Description and Teaching Materials
Overview
This activity explores the ancient Egyptian system of representing rational numbers using sums of unit fractions, based on the Rhind Mathematical Papyrus. Students will implement a decomposition algorithm in MATLAB to simulate and analyze how ancient Egyptian mathematicians might have approached fraction calculations.
Learning Goals
Content and Conceptual Goals
Understand the concept and historical use of unit fractions.
Analyze the mathematical practices of ancient Egypt, particularly fraction decomposition.
Compare ancient and modern methods for working with rational numbers.
Explore the historical significance of the Rhind Mathematical Papyrus.
MATLAB Learning Goals
Implement an algorithm in MATLAB to perform Egyptian fraction decomposition.
Use MATLAB to simulate, analyze, and optionally visualize mathematical processes.
Gain experience with loops, conditionals, and arrays in a mathematical coding context.
Higher-Order Thinking Skills
Develop computational thinking and basic algorithm design.
Strengthen critical thinking through comparison of algorithmic approaches.
Synthesize historical context with modern computation tools.
Practice debugging and iterative improvement of code.
Other Skills
Interpreting historical texts or summaries of ancient mathematics.
Communication: writing a clear explanation of the algorithm and its historical basis.
Oral presentation of project findings.
Target Audience and Setting
Undergraduate students in a History of Mathematics, Introduction to Number Theory, or Mathematical Thinking course.
Small to medium (10–35 students) class size.
Liberal arts colleges, universities, or community colleges.
Prerequisites
- Basic MATLAB proficiency.
- Understanding of fractions and rational numbers.
- No prior experience with Egyptian mathematics required.
Activity Type and Timing
- Project-based learning activity.
- Out-of-class project or module-based assignment.
- 2 weeks recommended.
- Week 1: Historical research & background reading.
- Week 2: Algorithm design, implementation, and early testing.
- Week 3: Analysis, visualization, and reflection/presentation.
- Individual or small group project.
- Deliverables include MATLAB code implementation, a short written report or presentation explaining the algorithm and historical context, or visualizations of fraction decomposition.
Project Components
1. Historical Background
- Students research the Egyptian approach to fractions and unit fractions.
- Introduce the Rhind Mathematical Papyrus and its significance.
- Discuss various examples.
2. Analysis and Visualization
- Compare different decompositions.
- Plot unit fraction sizes to illustrate how they sum to the original fraction.
- Discuss efficiency and length of decompositions.
3. Reporting and Reflection
Students write a brief report or give a presentation covering the following.
- Historical background.
- Algorithm and code explanation.
- Sample outputs and what they reveal.
- Personal or group reflection.
Assessment Criteria
- Accuracy and depth of research.
- Functionality and clarity of code.
- Accuracy of decomposition and explanation.
- Clarity in a written report or presentation.
- Thoughtfulness in reflection or extension.
Adaptability
- Provide a starter code or limit to specific fractions.
- Include alternative algorithms or explore connections to number theory or cryptography.
- Emphasize algorithm efficiency and computational complexity in a computer science course.
- Focus on pedagogy and historical perspectives in an education course.
Resources Needed
- Access to MATLAB or MATLAB Online.
- Access to library or web resources for historical research.
- MATLAB plotting functions for visualization.
- The following references may also be helpful for learning about Egyptian mathematics.
- Chace, Arnold Buffum. (1927). The Rhind Mathematical Papyrus: British Museum 10057 and 10058. Mathematical Association of America.
- Clagett, Marshall. (1999). Ancient Egyptian Science: A Source Book. Volume 3: Ancient Egyptian Mathematics. American Philosophical Society
- Gillings, Richard J. (1972). Mathematics in the Time of the Pharaohs. Dover Publications.
- Imhausen, Annette. (2003). "Egyptian Mathematics." In The Mathematics of Egypt, Mesopotamia, China, India, and Islam: A Sourcebook, edited by Victor Katz, Princeton University Press.
- Katz, Victor J. (2009). A History of Mathematics: An Introduction. Addison-Wesley.
Teaching Notes and Tips
Start with a historical context discussion. Use images or excerpts from the Rhind Mathematical Papyrus to spark curiosity. Discuss why the Egyptians might have used only unit fractions. Introduce unit fractions hands-on. Have students manually decompose a few small fractions before jumping into MATLAB. This helps reinforce the underlying concept before coding begins.
Give a MATLAB warm-up before assigning the full project. If needed, provide a partial function template to reduce cognitive load and keep the focus on algorithmic logic and historical connections. Suggest students try different algorithms. Let them experiment with inefficient versus elegant solutions and compare results. Periodically remind students that this isn't just a coding task—it's an exploration of mathematical development over time. Encourage reflection on what ancient solutions say about mathematical thinking before modern notation and tools. When students encounter errors, prompt them with questions. Teach them how to use MATLAB's disp() and fprintf() statements to debug.
If time allows, encourage students to visualize the decomposition using pie charts, bar plots, or step graphs showing how unit fractions add up to the target. This can turn a technical result into a compelling visual explanation. In small groups, you may assign roles such as leading background research or coding. This allows students to contribute based on their strengths.
Share how Egyptian methods influenced later civilizations. Mention that the Greedy algorithm was described in Fibonacci's Liber Abaci, tying historical math to algorithmic development. Accept reports in different formats, such as short papers, slideshows with code walkthroughs, and interactive MATLAB live scripts.
The MATLAB code below demonstrates how to use the greedy algorithm to decompose a fraction into unit fractions.
% Egyptian Fraction Decomposition using the Greedy Algorithm
% -----------------------------------------------------------
% This program expresses a given positive rational number
% as a sum of distinct unit fractions, following the ancient
% Egyptian method.
%
% Example: 5/6 = 1/2 + 1/3
clear; clc;
% --- Input: specify the fraction ---
num = 5; % numerator
den = 6; % denominator
fprintf('Decomposing %d/%d into Egyptian fractions:\n', num, den);
% --- Initialize variables ---
egyptian = [ ]; % to store denominators of unit fractions
while num > 0
% Step 1: find the ceiling of denominator/numerator
unit_den = ceil(den / num);
% Step 2: append this unit fraction
egyptian = [egyptian unit_den];
% Step 3: subtract the unit fraction from the current fraction
% new fraction = num/den - 1/unit_den
num = num * unit_den - den;
den = den * unit_den;
% Step 4: simplify the fraction (optional but good practice)
g = gcd(num, den);
num = num / g;
den = den / g;
end
% --- Display the result ---
fprintf('Egyptian fraction decomposition:\n');
for i = 1:length(egyptian)
fprintf('1/%d', egyptian(i));
if i < length(egyptian)
fprintf(' + ');
else
fprintf('\n');
end
end
Alternatively, students can work through this activity using a MATLAB live script: EgyptianFractions.mlx (MATLAB Live Script 5kB Oct28 25).
Assessment
Students will write a brief report or give a presentation covering the historical background, the algorithm and code explanation, sample outputs, and what they reveal, and a personal or group reflection. They will be assessed on accuracy and depth of research, functionality and clarity of code, accuracy of decomposition and explanation, clarity in the written report or presentation, and thoughtfulness in reflection or extension. The following rubric can be used to assess their report.
| Criteria | Excellent | Proficient | Developing | Insufficient |
|---|---|---|---|---|
| Accuracy and Depth of Research | Demonstrates thorough and accurate understanding of the algorithm's history and context; integrates multiple credible sources and clearly connects them to the project. | Shows accurate understanding with adequate depth; uses credible sources but connections could be more fully developed. | Demonstrates limited understanding; minor inaccuracies or shallow research; few or weak sources. | Contains major inaccuracies, minimal research, or missing historical background. |
| Functionality and Clarity of Code | Code runs correctly and efficiently; structure and style are clear, readable, and well-documented; demonstrates strong understanding of algorithm implementation. | Code is mostly functional with minor errors; organization and comments are generally clear; shows solid understanding of implementation. | Code runs with partial success or significant errors; readability or documentation is weak; demonstrates incomplete understanding. | Code is nonfunctional or missing; lacks clarity and documentation; shows little understanding of implementation. |
| Decomposition and Explanation of Algorithm | Accurately decomposes algorithm into logical parts; explanations are precise, insightful, and demonstrate strong conceptual understanding. | Mostly accurate decomposition and explanation; some minor gaps or imprecise phrasing. | Partial decomposition or unclear explanation; conceptual understanding is limited. | Decomposition inaccurate or missing; explanations unclear or incorrect. |
| Clarity and Organization of Report/Presentation | Report or presentation is exceptionally well-organized, clear, and engaging; visuals or formatting enhance understanding. | Clear and organized with logical flow; minor issues in clarity or engagement. | Some organization present but lacks smooth flow or clarity; visuals or formatting inconsistent. | Disorganized, confusing, or incomplete; lacks coherence and clarity. |
| Reflection and Extension | Reflection offers deep insight into learning process, challenges, and potential extensions; demonstrates critical thinking and self-awareness. | Reflection is thoughtful and complete, with some insight into learning or challenges. | Reflection is brief, general, or lacks depth; limited self-assessment or extension ideas. | Reflection is missing, superficial, or unrelated to project. |
References and Resources
Students will need access to MATLAB or MATLAB Online, library or web resources for historical research, and possibly MATLAB plotting functions for visualization. The following references may also be helpful for learning about Egyptian mathematics.
- Chace, Arnold Buffum. (1927). The Rhind Mathematical Papyrus: British Museum 10057 and 10058. Mathematical Association of America.
- Clagett, Marshall. (1999). Ancient Egyptian Science: A Source Book. Volume 3: Ancient Egyptian Mathematics. American Philosophical Society
- Gillings, Richard J. (1972). Mathematics in the Time of the Pharaohs. Dover Publications.
- Imhausen, Annette. (2003). "Egyptian Mathematics." In The Mathematics of Egypt, Mesopotamia, China, India, and Islam: A Sourcebook, edited by Victor Katz, Princeton University Press.
- Katz, Victor J. (2009). A History of Mathematics: An Introduction. Addison-Wesley.