0% found this document useful (0 votes)
12 views98 pages

Image Processing with Matrices and Python

Uploaded by

Abdul Sami
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views98 pages

Image Processing with Matrices and Python

Uploaded by

Abdul Sami
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Image Processing

Authors:
Tamar Avineri, North Carolina School of Science and Mathematics, Durham
NC
Emily Berkeley, Panther Creek High School, Cary, NC
Ashley Miller, North Rowan High School, Spencer, NC

Advisors: Eric Hallman, Rachel Minster, and Arvind K. Saibaba


(asaibab@[Link])
North Carolina State University

Abstract: In this all-inclusive module students will learn how to use matrices and
vectors to manipulate and edit images. The students will be provided with their
own image editing activity where they will create their own classroom “Instagram
feed.” There is also an extension activity that incorporates some basic Python
programming into this module.
2

The authors would like to acknowledge the support of the National Science
Foundation through the grant DMS-1845406

Implementation Notes 3
Lesson 1: Introduction to Matrices and Matrix Operations 5
Lesson Plan 5
Guided Notes – Teacher Version 9
Lesson 2: Matrix Multiplication 14
Lesson Plan 14
Guided Notes – Teacher Version 16
Lesson 3: Introduction to Image Processing 22
Lesson Plan 22
Guided Notes – Teacher Version 25
Lesson 4: (Extension) Image Processing using Computer Science 42
Lesson Plan 42
Lesson 5: Instagram Project 44
Lesson Plan 44
Warm-Up – Teacher Version 46
Instagram Project 49
References and Additional Readings 51
Appendices 52
Appendix A: Lesson Materials – Student Versions 52
Lesson 1: Guided Notes – Student Version 52
Lesson 2: Guided Notes – Student Version 58
Lesson 3: Guided Notes – Student Version 66
Lesson 5: Warm-Up – Student Version 11
Appendix B: Lesson Materials – Templates/Examples 14
Lesson 4: Math Symbols Image 14
Lesson 5: Instagram Project Stock Images 15
Lesson 5: Instagram Project Example 17
3

Implementation Notes
 Length of module:
 In total, this unit is designed to take approximately 3.5 days of
90-minute lessons, or 7 days of 45-minute lessons, including the
final project. There is also an extension project that is designed
to take approximately 85 minutes.
 Each of the lessons is accompanied by an estimate of the length
of time it is designed to take in class. If the estimate is longer
than you can devote in class, feel free to select portions for
students to complete outside of class.
 There is an extension project that includes coding in Python.
This is a lesson that is intended for Discrete Math for Computer
Science but would be a great tool if you have the extra time to
implement the lesson in the Math 4 or Pre-Calculus class.

 Relevant courses: This module is designed to be self-contained, as


the first 2 lessons provide foundational knowledge in the linear
algebra skills that students will need for the subsequent lessons. The
materials are appropriate for any NC Math 4, Pre-Calculus, or
Discrete Mathematics for Computer Science courses. This could also
serve as an interesting study following the AP exam for students in AP
Calculus AB or BC.

 Mathematical practices/student learning outcomes: In addition


to the standards for mathematical practices, this module addresses
several standards covered in NC Math 4, Pre-Calculus, and Discrete
Mathematics for Computer Science.
 Mathematical practices:
 Make sense of problems and persevere in solving them.
 Reason abstractly and quantitatively.
 Construct viable arguments and critique the reasoning of
others.
 Model with mathematics.
 Use appropriate tools strategically.
 Attend to precision.
 Look for and make use of structure.
4

 Look for and express regularity in repeated reasoning.


 Use strategies and procedures flexibly.
 Reflect on mistakes and misconceptions.
 NC Math 4: NC.M4.N.2.1 Execute procedures of addition,
subtraction, multiplication, and scalar multiplication on
matrices; NC.M4.N.2.2 Execute procedures of addition,
subtraction, and scalar multiplication on vectors.
 Precalculus: PC.N.2.1 Execute the sum and difference
algorithms to combine matrices of appropriate dimensions;
PC.N.2.2 Execute associative and distributive properties to
matrices; PC.N.2.3 Execute commutative property to add
matrices; PC.N.2.4 Execute properties of matrices to multiply a
matrix by a scalar; PC.N.2.5 Execute the multiplication
algorithm with matrices.
 Discrete Mathematics for Computer Science: DCS.N.1.1
Implement procedures of addition, subtraction, multiplication,
and scalar multiplication on matrices; DCS.N.1.2 Implement
procedures of addition, subtraction, and scalar multiplication on
vectors; DCS.N.1.3 Implement procedures to find the inverse of
a matrix; DCS.N.2.1 Organize data into matrices to solve
problems; DCS.N.2.2 Interpret solutions found using matrix
operations in context; DCS.N.2.3 Represent a system of
equations as a matrix equation; DCS.N.2.4 Use inverse matrices
to solve a system of equations with technology.

 Assessments:
 Feel free to select portions of the guided notes to serve as out-
of-class activities.
 Any problem set contained within guided notes could be given
as homework assignments.
 As an alternative to the final project in this module, you could
choose to give students a standard test or quiz on the skills that
have been learned.

 Online delivery suggestions:


 For asynchronous online delivery, create instructional videos to
take students through the guided notes.
 For synchronous online delivery, display the guided notes on
your screen and take students through the activities while you
annotate on your screen (or writing on paper and using a
document camera).
 Share all prepared documents through a learning management
system so that students would have access to them at home
5

 For the project, you can have the students create the matrices
using Microsoft word (or if they have access to a tablet and a
note taking app, they can create the matrices on there), they
can use this website to create the pictures, and then they can
screen snip the pictures out and paste them into the final
document. They can then submit the project fully through an
online submission.

 List of accompanying documents:


 Lesson 4: Python or Jupyter Coding Template
 To download Jupyter click HERE

 Student Versions: Please note that the student versions are located
at the end of this document in Appendix A.

Lesson 1: Introduction to Matrices and


Matrix Operations

Lesson Plan
6

Standards Topic/Day: Introduction to Matrices, Matrix


NC.M4.N.2.1 Execute procedures of Addition/Subtraction, and Scalar Multiplication
addition, subtraction, multiplication, Content Objective: Elementary Matrix
and scalar multiplication on matrices Operations
Vocabulary: matrix; row; column; dimension;
PC.N.2.1 Execute the sum and square; transpose
difference algorithms to combine
matrices of appropriate dimensions;
PC.N.2.2 Execute associative and
distributive properties to matrices;
PC.N.2.3 Execute commutative
property to add matrices; PC.N.2.4
Execute properties of matrices to
multiply a matrix by a scalar;

DCS.N.1.1 Implement procedures of


addition, subtraction, multiplication
and scalar multiplication on matrices.

(~60 minutes)

Time Student Does Teacher Does

Warm Up ~15 Students read the opening Teacher hands out a


Elicit/Engage min problem (e.g., Textbook Problem sheet of paper with the
Build relevance through or other context of interest) from opening problem
a problem a handout and/or projected on a written on it and/or
Try to find out what screen. projects it on the
your students already In groups of 2-3, students talk screen. Teacher opens
know briefly about how they would with the question,
Get them interested answer the question from the “How might we
teacher. (~5 minutes) The organize this
teacher brings back students to information in a way
share out with the class. (~3 that allows us to
minutes) answer questions
Students are provided guided about the university’s
notes to document new terms inventory?”
(e.g., matrix, dimension, row,
column, etc.) They will complete After students discuss,
the notes through the discussion the teacher solicits
7

conducted by the teacher. (~5 students’ responses.


minutes)
If students do not
suggest a matrix, the
teacher will introduce
the name and ask
students if they are
familiar with the term.
If not, the teacher will
define it through one
of the matrices used to
organize the
information in the
problem.

Explore I Students complete the second Teacher circulates the


Connectivity to build ~15 matrix from the problem in their room to
understanding of min groups. (~5 min) observe/monitor
concepts students’ work.
Allow for collaboration Students work in groups of 2-3 to
consider heterogeneous answer teacher’s question. (~5 Teacher then poses
groups minutes) question: “How could
Move deliberately from we use these matrices
concrete to abstract to determine the total
Apply scaffolding & inventory of books at
personalization the university?”

Once students have


some time to answer
question, teacher
returns to full class
discussion to ask how
we could define matrix
addition.

Explain I ~5 Students offer their ideas on how Teacher conducts


Personalize/Differentiate min to define matrix addition (and discussion on matrix
as needed subtraction). addition and
Adjust along subtraction.
teacher/student Students engage in class
centered continuum discussion on teachers’ questions. Teacher poses
questions: “Is matrix
8

Provide vocabulary addition commutative?


Clarify understandings Is it associative? Is
matrix subtraction
commutative? Is it
associative? Why/why
not?”

Explore II Students work in groups of 2-3 to Teacher then poses


Connectivity to build ~5 answer teacher’s question. (~5 question: “How could
understanding of min minutes) we use these matrices
concepts to determine the
Allow for collaboration inventory of books at
consider heterogeneous the university if the
groups librarian would like to
Move deliberately from double the inventory?”
concrete to abstract
Apply scaffolding & Once students have
personalization some time to answer
question, teacher
returns to full class
discussion to ask how
we could define scalar
multiplication..

Explain II ~5 Students offer their ideas on how Teacher conducts


Personalize/Differentiate min to define scalar multiplication. discussion on scalar
as needed multiplication.
Adjust along
teacher/student
centered continuum
Provide vocabulary
Clarify understandings

Extend ~15 Students complete class problem Teacher circulates the


Apply knowledge to new min set in groups of 2-3 to apply their room and
scenarios new knowledge. observes/monitors
Continue to personalize students’ work.
as needed
Consider grouping
homogeneously

Evaluate N/A Students will complete guided Teacher will review


Formative Assessment notes and a problem set for students’ work as they
9

How will you know if practice. Students turn in their circulate room and
students understand solutions to the last problem in monitor progress,
throughout the lesson? the problem set as an exit ticket engaging students who
(e.g., Stereo Problem) may be having
difficulty in discussion
to probe their
thinking.

Evaluate N/A N/A N/A


Summative-like
Assessment
Questions similar to
final assessment
10

Guided Notes – Teacher Version


Matrix Addition, Subtraction and Scalar Multiplication

A university is taking inventory of the books they carry at their two biggest
bookstores.
The East Campus bookstore carries the following books:
Hardcover: Textbooks-5280; Fiction-1680; NonFiction-2320; Reference-
1890
Paperback: Textbooks-1930; Fiction-2705; NonFiction-1560; Reference-
2130

The West Campus bookstore carries the following books:


Hardcover: Textbooks-7230; Fiction-2450; NonFiction-3100; Reference-
1380
Paperback: Textbooks-1740; Fiction-2420; NonFiction-1750; Reference-
1170

In order to work with this information, we can represent the inventory of each
bookstore using an organized array of numbers known as a matrix.

Definitions: A matrix is a rectangular table of entries and is used to


organize data in a way that can be used to solve problems. The following is a
list of terms used to describe matrices:

 A matrix’s size (or dimension) is written by listing the number of

rows “by” the number of columns.

 The values in a matrix, A, are referred to as entries or elements.

The entry in the “mth” row and “nth” column is written as a mn.

 A matrix is square if it has the same number of rows as it has columns.


11

 If a matrix has only one row, then it is a row vector. If it has only one

column, then the matrix is a column vector.

 The transpose of a matrix, A, written AT, switches the rows with the

columns of A and the columns with the rows.

 Two matrices are equal if they have the same size and the same

corresponding entries.
12

The inventory of the books at the East Campus bookstore can be


represented with the following 2 x 4 matrix:
T FN R
E=
[
Hardback 5280 1680 2320 1890
Paperback 1930 2705 1560 2130 ]
Similarly, the West Campus bookstore’s inventory can be represented with
the following matrix:

T
FN R
W=
[
Hardback 7230 2450 3100 1380
Paperback 1740 2420 1750 1170 ]
Adding and Subtracting Matrices

In order to add or subtract matrices, they must first be of the same size.
The result of the addition or subtraction is a matrix of the same size as the
matrices themselves, and the entries are obtained by adding or subtracting
the elements in corresponding positions.

In our campus bookstores example, we can find the total inventory between
the two bookstores as follows:

E+W =
[5280
1930
+
][
1680 2320 1890 7230 2450 3100 1380
2705 1560 2130 1740 2420 1750 1170 ]
T FN R

= [
Hardback 12510 4130 5420 3270
Paperback 3670 5125 3310 3300 ]
13

Question: Is matrix addition commutative (e . g . , A + B=B+ A)? Why or why


not?
Matrix addition is commutative. This is because the operation is based in
the addition of real numbers, as the entries of each matrix are added to
their corresponding entries in the other matrix/matrices. Since addition of
real numbers is commutative, so is matrix addition.

Question: Is matrix subtraction commutative (e . g . , A−B=B−A )? Why or


why not?
Matrix subtraction is not commutative. This is because the operation is
based in the subtraction of real numbers, as the entries of each matrix are
subtracted from their corresponding entries in the other matrix/matrices.
Since subtraction of real numbers is not commutative, neither is matrix
subtraction.

Question: Is matrix addition associative (e . g . , ( A + B ) +C=A +(B+C ))? Why or


why not?
Matrix addition is associative. This is because the operation is based in the
addition of real numbers, as the entries of each matrix are added to their
corresponding entries in the other matrix/matrices. Since addition of real
numbers is associative, so is matrix addition.

Question: Is matrix subtraction associative (e . g . , ( A−B )−C= A−(B−C))? Why


or why not?
Matrix subtraction is not associative. This is because the operation is based
in the subtraction of real numbers, as the entries of each matrix are
subtracted from their corresponding entries in the other matrix/matrices.
Since subtraction of real numbers is not associative, neither is matrix
subtraction.

Scalar Multiplication

Multiplying a matrix by a constant (or scalar) is as simple as multiplying


each entry by that number! Suppose the bookstore manager in East Campus
wants to double his inventory. He can find the number of books of each
14

type that he would need by simply multiplying the matrix E by the scalar (or
constant) 2. The result is as follows:
T FN R T FN R

2 E=2∗
[5280
1930
1680 2320 1890
2705 1560 2130
=] [
2(5280) 2(1680) 2(2320) 2(1890)
2(1930) 2(2705) 2(1560) 2(2130) ]
T FN R

= [
Hardback 10560 3360 4640 3780
Paperback 3860 5410 3120 4260 ]
15

Exercises: Consider the following matrices:

[ ] [ ] []
1 0 1 0 6 −21 5
A= 2 −4 3 B=[ 2 8 −6 ] C= 2 4 −9 D= −2
−6 1 8 5 −7 1 3

Find each of the following, or explain why the operation cannot be


performed:

a. A+ B: This operation cannot be performed, since matrices A and B are of


different dimensions.

b. B – A : This operation also cannot be performed, as A and B have different


dimensions.

[ ][ ][ ]
1 0 1 0 6 −21 1 −6 22
c. A−C= 2 −4 3 − 2 4 −9 = 0 −8 12
−6 1 8 5 −7 1 −11 8 7

[ ][ ][ ]
0 6 −21 1 0 1 −1 6 −22
d. C− A= 2 4 −9 − 2 −4 3 = 0 8 −12
5 −7 1 −6 1 8 11 −8 −7

e. 5 B=5∗[ 2 8 −6 ]= [ 10 40 −30 ]

[ ] [ ]
1 0 1 0 6 −21
f. – A +4 C=− 2 −4 3 +4∗ 2 4 −9 =¿
−6 1 8 5 −7 1

[ ][ ][ ]
−1 0 −1 0 24 −84 −1 24 −85
−2 4 −3 + 8 16 −36 = 6 20 −39
6 −1 −8 20 −28 4 26 −29 −4
16

g. B – D : This operation cannot be performed, since B and D are not of the same
size.

[ ] [ ]
0 6 −21 1 0 1
h. 2 C−6 A=2∗ 2 4 −9 −6∗ 2 −4 3 =¿
5 −7 1 −6 1 8

[ ][ ][ ]
0 12 −42 6 0 6 −6 12 −48
4 8 −18 − 12 −24 18 = −8 32 −36
10 −14 2 −36 6 48 46 −20 −46

[ ][ ] [ ]
2 5 7
T
i. B + D= 8 + −2 = 6
−6 3 −3
17

Lesson 2: Matrix Multiplication

Lesson Plan

Topic/Day: Matrix Multiplication


Standards Content Objective: Elementary Matrix
Operations
NC.M4.N.2.1 Execute procedures of
addition, subtraction, multiplication,
and scalar multiplication on matrices

PC.N.2.1 Execute the sum and


difference algorithms to combine
matrices of appropriate dimensions;
PC.N.2.2 Execute associative and
distributive properties to matrices;
PC.N.2.3 Execute commutative
property to add matrices; PC.N.2.4
Execute properties of matrices to
multiply a matrix by a scalar;

DCS.N.1.1 Implement procedures of


addition, subtraction, multiplication
and scalar multiplication on matrices; (~70 minutes)
DCS.N.2.1 Organize data into
matrices to solve problems; DCS.N.2.2
Interpret solutions found using matrix
operations in context

Tim Student Does Teacher Does


e
18

Warm Up ~5 Students read the opening Teacher hands out a


Elicit/Engage
min problem (e.g., Opera Problem or sheet of paper with the
Build relevance
other context of interest) from a opening problem
through a problem
handout and/or projected on a written on it and/or
Try to find out what
screen. projects it on the
your students already
screen. Teacher opens
know
Get them interested with the question,
“How might we
organize this
information in a way
that allows us to
answer the question?”

Explore In groups of 2-3, students work Teacher asks students


Connectivity to build ~15
understanding of together to calculate each value to calculate each value
concepts min of interest by hand (not using any of interest by hand,
Allow for collaboration specific method). (~10 minutes) showing their work but
consider heterogeneous
groups not using any specific
Move deliberately from method.
concrete to abstract Students work in groups of 2-3 to
Apply scaffolding & answer teacher’s question. (~10
personalization The teacher brings
minutes) Students can break the
students back to share
work up among their group
their results and
members.
confirm their results
with other groups.

Explain ~15 Students follow along the Teacher conducts


Personalize/
Differentiate as needed min teachers’ explanation on their lesson on matrix
Adjust along opening problem. multiplication using
teacher/student the opening problem
centered continuum
Provide vocabulary Students share their thoughts on to demonstrate the
Clarify understandings teacher’s posed questions. operation.

Teacher poses
questions: “Is matrix
multiplication
commutative? Is it
associative? Why/why
not?” Teacher
provides examples of
19

why they are/aren’t,


and students practice
the operation with
those examples.

Extend ~25 Students complete class problem Teacher will review


Apply knowledge to
new scenarios min set in groups of 2-3 to apply their students’ work as they
Continue to personalize new knowledge. circulate room and
as needed
Consider grouping monitor progress,
homogeneously engaging students who
may be having
difficulty in discussion
to probe their
thinking.

Teacher brings class


back together to
engage in debrief on
the problem set.

Evaluate ~10 Students work on exit ticket Teacher poses exit


Assessment
How will you know if min problem and turn it in. ticket problem for
students understand students to turn in.
throughout the lesson?

Guided Notes – Teacher Version


Matrix Multiplication

The Metropolitan Opera is planning its last cross-country tour. It plans to


perform Carmen and La Traviata in Atlanta in May. The person in charge of
logistics wants to make plane reservations for the two troupes. Carmen has 2
stars, 25 other adults, 5 children, and 5 staff members. La Traviata has 3 stars,
15 other adults, and 4 staff members. There are 3 airlines to choose from.
Redwing charges round-trip fares to Atlanta of $630 for first class, $420 for
coach, and $250 for youth. Southeastern charges $650 for first class, $350 for
coach, and $275 for youth. Air Atlanta charges $700 for first class, $370 for
20

coach, and $150 for youth. Assume stars travel first class, other adults and staff
travel coach, and children travel for the youth fare.

Use multiplication and addition to find the total cost for each troupe to travel
each of the airlines.

Carmen/Redwing: 2 ( 630 ) +30 ( 420 )+ 5 ( 250 )=$ 15110

Carmen/Southeastern: 2 ( 650 ) +30 ( 350 ) +5 ( 275 )=$ 13175

Carmen/Air Atlanta: 2 ( 700 ) +30 ( 370 ) +5 ( 150 )=$ 13250

La Traviata/Redwing: 3 ( 630 ) +19 ( 420 )+ 0 ( 250 )=$ 9870

La Traviata/Southeastern: 3 ( 650 ) +19 ( 350 ) +0 ( 275 )=$ 8600

La Traviata/Air Atlanta:3 ( 700 ) +19 ( 370 ) +0 ( 150 ) =$ 9130


21

It turns out that we can solve problems like these using a matrix operation,
specifically matrix multiplication!

We first note that matrix multiplication is only defined for matrices of certain
sizes. For the product AB of matrices A and B, where A is an m x n matrix, B
must have the same number of rows as A has columns. So, B must have size
n x p. The product AB will have size m x p.

Exercises

The following is a set of abstract matrices (without row and column labels):

[ ]
2 4 1
M= [ 1 −1
2 0 ]
N= 0 −1 3 O=
1 0 2
6
−1 [ ]

[ ] [] [
1
0 4
P=
−1
2
1
Q= 1 R=
3
3 1
−1 0 ]
2

[ ][][ ]
3 1 1
4 2 6 −1
1 0 2
S= T= U= 5 3 1 0
0 2 −3
0 2 −1 1
−1 1 4

List at least 5 orders of pairs of matrices from this set for which the product
is defined. State the dimension of each product.

MO: 2x1 MP: 2x2 PM: 2x2 MR: 2x2 RM: 2x2 NQ: 3x1

NU: 3x4 PO: 2x1 US: 3x2 UT: 3x1


22

Back to the opera…

Define two matrices that organize the information given:

[
stars adults children 2 30 5 ¿
¿ 3 19 0 ]
[ ]
630 650 700
Red South Air
420 350 370 ¿
¿
250 275 150

We can multiply these two matrices to obtain the same answers we obtained
above, all in one matrix!

[ ]
630 650 700
¿ [
stars adults children 2 30 5 ¿ Red
3 19 0 ] South Air
¿
420 350 370 ¿
250 275 150

¿ Red
¿ [9870 8600 9130 ]
South Air 15110 13175 13250 ¿

Carmen/Redwing: $ 15110

Carmen/Southeastern: $ 13175

Carmen/Air Atlanta: $ 13250

La Traviata/Redwing: $ 9870

La Traviata/Southeastern: $ 8600

La Traviata/Air Atlanta: $ 9130


23

Exercises

1. The K.L. Mutton Company has investments in three states - North


Carolina, North Dakota, and New Mexico. Its deposits in each state are
divided among bonds, mortgages, and consumer loans. The amount of
money (in millions of dollars) invested in each category on June 1 is
displayed in the table below.
NC ND N

Bonds 13 25 22
Mort. 6 9 4
Loans 29 17 13

The current yields on these investments are 7.5% for bonds, 11.25% for
mortgages, and 6% for consumer loans. Use matrix multiplication to find
the total earnings for each state.

Total earnings for each state (in millions of dollars):

[ ]
13 25 22
Bonds Mort . Loans NC ND NM NC ND NM
6 9 4 ¿=
[ 1.075 1.1125 1.06 ] ¿
29 17 13
[ 3.39 3.9075 2.88 ]

2. Several years ago, Ms. Allen invested in growth stocks, which she hoped
would increase in value over time. She bought 100 shares of stock A, 200
shares of stock B, and 150 shares of stock C. At the end of each year she
records the value of each stock. The table below shows the price per
share (in dollars) of stocks A, B, and C
1984 1985 1986
at the end of the years 1984, 1985,
and 1986. Stock 68.0 72.00 75.0
A 0 0
Stock 55.0 60.00 67.5
B 0 0
Stock 82.5 84.00 87.0
C 0 0

Calculate the total value of Ms. Allen’s stocks at the end of each year.

Total value of the stocks (in dollars) at the end of each year:

[ ]
68 72 75
A B C 1984 1985 1986 1984 1985 1986
55 60 67.5 ¿=
[ 100 200 150 ] ¿
82.5 84 87
[ 30,175 31,800 34,050 ]
24
25

3. The Sound Company produces stereos. Their inventory includes four


models - the Budget, the Economy, the Executive, and the President
models. The Budget needs 50 transistors, 30 capacitors, 7 connectors,
and 3 dials. The Economy model needs 65 transistors, 50 capacitors, 9
connectors, and 4 dials. The Executive model needs 85 transistors, 42
capacitors, 10 connectors, and 6 dials. The President model needs 85
transistors, 42 capacitors, 10 connectors, and 12 dials. The daily
manufacturing goal in a normal quarter is 10 Budget, 12 Economy, 11
Executive, and 7 President stereos.

a. How many transistors are needed each day? Capacitors? Connectors?


Dials?

b. During August and September, production is increased by 40%. How


many Budget, Economy, Executive, and President models are produced
daily during these months?

c. It takes 5 person-hours to produce the Budget model, 7 person-hours


to produce the Economy model, 6 person-hours for the Executive
model, and 7 person-hours for the President model. Determine the
number of employees needed to maintain the normal production
schedule, assuming everyone works an average of 7 hours each day.
How many employees are needed in August and September?

Define the matrices for the inventory parts (I ) and the daily
manufacturing goal(N ) as

[ ]
50 30 7 3
t ca co d 65 50 9 4 B Ec Ex P
I= ¿∧N=
¿ 85 42 10 6 [ 10 12 11 7 ]
85 42 10 12

a. The answers are the results of the matrix multiplication

t ca co d
¿=
[ 2810 1656 358 228 ]

b. The new daily manufacturing goals are given by

B Ec Ex P
1.4 N =
[ 14 16.8 15.4 9.8 ]

Which should be rounded to integer quantities


26

c. Define a matrix H for hours of labor as

[]
5
7
H= ¿ Hrs . ¿
¿ 6
7

The number of labor hours needed per week is given by

NH =249

With 7-hour workdays, the number of employees needed is


249
=35.6, which implies that 36 employees are needed to maintain
7
1.4 NH 348.6
full production. For August and September, we want = ,
7 7
which rounds to 50.

4. The president of the Lucrative Bank is hoping for a 21% increase in


checking accounts, a 35% increase in savings accounts, and a 52%
increase in market accounts. The current statistics on the number of
accounts at each branch are as follows:

Checkin Saving Market


g s

[ ]
Northgate 40039 10135 512
Downtown 15231 8751 105
South 25612 12187 97
What is the Square goal
for each branch in each type of account? (HINT: multiply by a 3 ×2 matrix
with certain nonzero entries on the diagonal and zero entries elsewhere.)
What will be the total number of accounts at each branch?

The goal for each branch in each type of account is given by:

[ ] [ ]
40039 10135 512 1.21 0 0
csm c s m
15231 8751 105 ¿ ⋅ 0 1.35 0 ¿
¿ ¿
25612 12187 97 0 0 1.52

[ ]
48447 13682 778.24
¿ ¿ c s m
18430 11814 159.6 ¿
¿
30991 16452 147.44
27

[]
1
Right-multiplying this result by the matrix 1 yields the following
1

[ ]
62907.68
¿ Total
total number of accounts at each branch: 30402.96 ¿.
¿
47590.41

Note: this answer can also be obtained by just adding up the


entries in each row of the previous matrix.

Lesson 3: Introduction to Image Processing

Lesson Plan

Standard Topic/Day: Introduction to Image Processing


DCS.N.1.1 Implement procedures Content Objective:
of addition, subtraction, Language Objective:
multiplication and scalar Vocabulary:
multiplication on matrices. Materials Needed:

(~90 minutes)

Tim Student Does Teacher Does


e

Warm Up ~10 Students work on nonogram Teacher opens with a


Elicit/Engage
min activity in groups of 2-3. color-by-number
Build relevance
nanogram-style image
through a problem (Activity site)
displayed to the class
Try to find out what
and prompts students
your students already
to complete the
know
Get them interested diagram. (Teacher
provides the
28

rules/process of
completing a
nanogram.)

Teacher opens
discussion with
students about what
pixels are and asks
students if they know
how to interpret the
numbers. Ultimately,
teacher concludes that
0 represents black and
255 represents white.

Explore I Students work in groups of 2-3 Teacher demonstrates


Connectivity to build ~10
understanding of through guided notes provided by how to draw an image
concepts min the teacher. The teacher will based on a matrix with
Allow for collaboration work through the first example the students
consider heterogeneous
groups with the students and then give (displaying the first
Move deliberately from them time to work the rest. matrix on the students’
concrete to abstract
Apply scaffolding & guided notes on the
personalization The guided notes would include screen for students to
both problems on drawing images follow.)
based on matrices and vice versa.
Teacher circulates the
room monitoring
students’ progress and
addressing questions
along the way.
The teacher brings
students back to share
and confirm their
results.

Explain Ia ~10 Students follow along the Teacher conducts


Personalize/
Differentiate as needed min teachers’ explanation. lesson on interpreting
Adjust along what the sum,
teacher/student Students then work together in difference, scalar
centered continuum
Provide vocabulary groups of 2-3 on practice multiplication and
Clarify understandings problems based on the teacher’s combinations of
lesson. operations of matrices
29

would represent in the


context of images.

Teacher brings back


class to discuss and
confirm results.

Explain Ib ~10 Students follow along the Teacher conducts


Personalize/
Differentiate as needed minu teachers’ explanation. lesson on “bits”
Adjust along tes
teacher/student
centered continuum
Provide vocabulary
Clarify understandings

Explore II Students work in groups of 2-3 Teacher demonstrates


Connectivity to build ~10
understanding of through guided notes provided by how to convert
concepts min the teacher. The teacher will matrices into vectors
Allow for collaboration work through the first example (displaying the first
consider heterogeneous
groups with the students and then give matrix on the students’
Move deliberately from them time to work the rest. guided notes on the
concrete to abstract
Apply scaffolding & screen for students to
personalization follow.)

Teacher circulates the


room monitoring
students’ progress and
addressing questions
along the way.

The teacher brings


students back to share
and confirm their
results.

Explain II ~15 Students engage in discussion as Teacher debriefs the


Personalize/
Differentiate as needed min a class, facilitated by the teacher. results from the
Adjust along They share their results up at the Explore session and
teacher/student board and present them to the conducts class
centered continuum
Provide vocabulary class. discussion on results.
Clarify understandings

Extend ~20 Students apply their new Teacher will review


30

Apply knowledge to min understanding to a problem set students’ work as they


new scenarios
Continue to personalize involving specific images. circulate room and
as needed monitor progress,
Consider grouping engaging students who
homogeneously
may be having
difficulty in discussion
to probe their
thinking.

Teacher brings class


back together to
engage in debrief on
the problem set.

Evaluate ~10 Students work on exit ticket Teacher poses exit


Formative
Assessment min problem and turn it in. ticket problem for
How will you know if students to turn in.
students understand
throughout the lesson?
Evaluate N/A Instagram Project (separate N/A
Summative-like
Assessment lesson)
Questions similar to
final assessment
31

Guided Notes – Teacher Version


Introduction to Image Processing Name:
___________________________
Part I: Image representation and processing Date: _______________
Period: ______

In this lesson, we will discuss representations of images and methods to


manipulate those images.

Figure: Image of a

Matrix representations:
 A grayscale image is a 2-dimensional array of numbers. An 8-bit

image has entries between 0 and 255.

 The value 255 represents a white color, and the value 0 represents a

black color.

 Lower numbers translate to darker pixels, while higher numbers

translate to lighter pixels.

 For an image that has m x n pixels (i.e., “picture elements”), we

represent that image using a matrix of size m x n. The entries of the

matrix indicate the pixel value of the corresponding part of the image.

Example: This table represents an image that has 4 x5

pixels.

Example: This 4 x 4 image of the raccoon is


represented by the
matrix on the right below:
32

Example: Write the matrix that represents the following image:

[ ]
255 255 255
255 0 255
255 255 255
0 255 0

Exercises:
1. Write a matrix that represents each of the following images.
a.

[ ]
0 255 255
255 0 255
255 0 255
255 255 0
255 0 255

b.

[ ]
255 255 255 255
0 255 0 255
255 255 255 0

2. Draw a visual representation of the following matrices.

[ ]
0 255 255
0 255 255
a.
255 0 0
255 255 0
33

[ ]
0 255 255
b. 0 0 255
0 255 255

c. [ 2550 0 0
255 0 ]

Color Images:
Color images can be stored in a similar fashion to a grayscale image.
Instead of one number (0-255) per pixel, one stores three numbers per pixel
– these three numbers denote the “amount” of red, “amount” of green, and
“amount” of blue in each pixel. These three numbers can be used to depict a
wide range of colors.
34

Image transformations:
Once images are represented as matrices, we can describe many
transformations of those images using basic matrix operations!
Example: Suppose we have two separate images that can be represented by the

matrices A=[ 2550 0


]
255
and B=[ 0 0
255 0 ]
.

1. Draw the images that correspond to A and B.


35

A B

2. Find and draw A+ B .

A+ B=
[ 255 0
+
][
0 0
0 255 255 0
=
255 0
][
255 255 ]

1
3. Compute C= A . How would you describe the image represented by C in
5
relation to the image represented by A ?
1
C= A=
5
1 255 0
5 0 255 [
=
51 0
0 51 ][ ]
The image represented by the matrix C would have pixels that are darker than
those in the image represented by matrix A .

Note: When mathematical operations on images result in entries that range


outside of the integer values 0 through 255, image visualization tools treat them as
255 if the value exceeds 255, and as 0 if the value is below 0.
36

Exercises:
1. a. Describe an image whose matrix representation contains entries of all zeros.
The image would be entirely black.

b. Describe an image whose matrix representation contains entries of all 255.


The image would be entirely white.

2. Let A and B be matrices that represent two images of the same size. Describe
in words what each of the following means.
a. A−B
This matrix represents the image that is the result of darkening the image
represented by A , if B has at least one nonzero entry.

b. 5 A + B
This matrix represents the lightening of the image represented by A , since all of
the values in A are multiplied by a positive number, and the entries in B are added
to those entries.

c. 255∗1− A , where “1” is the matrix of all 1’s


This matrix is the result of darkening an all-white image, since the entries in A are
all positive numbers (if A has at least one nonzero entry.
37

Part II: Manipulating images


Reflecting/rotating images
Let us consider how we might reflect an image over the x or y-axis. Here’s
an example!

How would we represent these reflections using matrices?


From our earlier work, we know that the image represented by the matrix
X=
[
255 0
0 255 ]
would be:

If we were to reflect this image about the x-axis, we would obtain:

[ 2550
The matrix X ' that represents this image is X =
0]
255
. We can generalize

this result!
Exercises:
1. Which matrix represents the image that is the reflection of the matrix

[ ]
0 a b 0
c d 0 0
A= about the x -axis?
e 0 f g
0 0 0 h
38

[ ]
0 0 0 h
e 0 f g
c d 0 0
0 a b 0

2. Write the matrix that corresponds to the reflection of each of the


following about the
a. x−¿axis
b. y−¿axis

[ ] [ ]
0 255 255 255 255 0
0 255 255 255 0 0
a. x−¿axis:
255 0 0 0 255 255
255 255 0 0 255 255

[ ]
255 255 0
255 255 0
y−¿axis:
0 0 255
0 255 255

[ ] [ ]
0 255 255 0 255 255
b. 0 0 255 x−¿axis: 0 0 255
0 255 255 0 255 255

[ ]
255 255 0
y−¿axis: 255 0 0
255 255 0

c. [ 2550 0 0
255 0 ] x−¿axis: [ 2550 255 0
0 0 ]
y−¿axis: [ 00 0 255
255 0 ]
39
40

Reflecting images using matrix-matrix multiplication

Consider the matrix X = [ 12 34 ] that represents an image . 1

Question: From our work above, we know that the matrix representing the

image reflected about the x -axis is


2 4
1 3 [ ]
. What matrix would we need to
multiply X by on the left in order to obtain the matrix of the image reflected
about the x -axis? Show that your answer gives you the correct result.

[ 01 10]
[ 01 10][ 12 34]=[21 43 ]
Question: From our work above, we know that the matrix representing the

image reflected about the y -axis is


3 1
4 2 [ ]
. What matrix would we need to
multiply X by on the right in order to obtain the matrix of the image
reflected about the y -axis? Show that your answer gives you the correct
result.

[ 01 10]
[ 12 34] [01 10]=[ 34 12]
The matrix you used above is a form of a permutation matrix (here
referred to as a reverse identity matrix). This matrix is always square, and
its size is determined by the size of the matrix it is multiplied to (i.e. in
order for the matrix multiplication to be performed).

Exercises:

1
Note that these values each represent a shade of color between white and black, where 0
represents black, and 1 represents white. While we have used only values of 0 and 255 thus far, we
will use these values in this example to make the reflections clear.
41

1. What size does the reverse identity matrix need to be to be used to


reflect an image represented by a 5 x 3 matrix about the x -axis? Why?
The matrix must be a 5 x 5 matrix, so that it can left-multiply the 5 x 5
matrix. The reverse identity matrix is square, and it must have the
same number of columns as the 5 x 3 matrix has rows.

2. What size does the reverse identity matrix need to be to be used to


reflect an image represented by a 5 x 3 matrix about the y -axis? Why?
The matrix must be a 3 x 3 matrix, so that it can right-multiply the 5 x 3
matrix. The reverse identity matrix is square, and it must have the
same number of rows as the 5 x 3 matrix has columns.

3. Use the reverse identity matrix of the appropriate size to reflect the
images represented by the following matrices about the x -axis.

[ ] [ ][ ][ ]
0 255 255 0 0 1 0 255 255 0 255 255
a. 0 0 255 0 1 0 0 0 255 = 0 0 255
0 255 255 1 0 0 0 255 255 0 255 255

[ ] [ ][ ][ ]
0 255 255 0 0 0 1 0 255 255 255 255 0
0 255 255 0 0 1 0 0 255 255 255 0 0
b. =
255 0 0 0 1 0 0 255 0 0 0 255 255
255 255 0 1 0 0 0 255 255 0 0 255 255

c. [ 2550 0 0
255 0 ] [ 01 10][ 2550 0 0
255 0][
=
0 255 0
255 0 0 ]
4. Use the reverse identity matrix of the appropriate size to reflect the
images represented by the following matrices about the y -axis.

[ ] [ ][ ] [ ]
0 255 255 0 255 255 0 0 1 255 255 0
a. 0 0 255 0 0 255 0 1 0 = 255 0 0
0 255 255 0 255 255 1 0 0 255 255 0
42

[ ][ ][ ] [ ]
0 255 255 0 255 255 255 255 0
0 0 1
0 255 255 0 255 255 255 255 0
b. 0 1 0=
255 0 0 255 0 0 0 0 255
1 0 0
255 255 0 255 255 0 0 255 255

][ ][
0 0 1
c. [
255 0 0
0 255 0 ] [ 255 0 0
0 255 0
0 1 0=
1 0 0
0 0 255
0 255 0 ]
Reflecting images using matrix-vector multiplication
We can also manipulate images using matrix-vector multiplication. This
method is a bit more powerful than matrix-matrix multiplication, because it
allows us with more flexibility in ways you can manipulate those images.

Using this method, we first convert our matrices into vectors (i.e., single
column or single row matrices).

 ⃗ ) as the vector conversion of the matrix X . In general, for


We define (X

[]

x1

X=
[ ⋮
x1
¿⋮
¿ ] ⃗ )=
x n ¿ ⋮ ¿ ¿⋮ ¿ , we have ( X ….

xn

[]
 We define mat ( X ) as the matrix conversion of the vector Y . In general,

x1

for Y = … , we have mat ( X )=

⋮ ¿⋮
x1 ¿ n [
x ¿⋮ ¿¿ ⋮ ¿
].
xn

Examples:
43

[]
1
1. For X = [ ]
1 3 (X
2 4
,
⃗ )= 2
3
.
4

[]
1
2
3

[ ]
1 4 7 4

2. For X = 2 5 8 , ( X )= 5 .
3 6 9 6
7
8
9

[]
3
5
3. For X = , mat ( X )=
6 [ ]
3 6
5 1
.
1

[]
1
0
0

[ ]
0 1 0 0
4. For X = 1 , mat ( X )= 0 1 0 .
0 0 0 1
0
0
1

Exercises:

1. Convert each of the following matrices into vectors.

[]
5
a. A= [ ]
5 0
3 4
( A)= 3

0
.
4
44

[]
2
b. B= [ ]
2 3
1 6
(⃗
B )=
1
3
.
6

[]
8
7
8

[ ]
8 8 8 8
⃗ )= 7
c. C= 7 7 7 (C .
8 8 8 8
8
7
8

2. Convert each of the following vectors into matrices.

[]
3
a. X =
5
6
mat ( X )=
[ 35 61]
1

[]
8
7
6

[ ]
5 8 5 2
b. Y = 4 mat (Y )= 7 4 1
3 6 3 0
2
1
0
45

Reflection about the axes using matrix-vector multiplication

[]
1
Consider the matrix X = [ ]
1 3
2 4
⃗ 2
. We know that ( X )= .
3
4

Question: From our earlier work, we know that the reflection of the image

[]
2
with matrix X about the x -axis would be Y = [ ]
2 4
1 3
⃗ 1
. So, ( Y )= . What matrix
4
3
⃗ ) by on the left in order to obtain ( Y⃗ ) ? Show
would we need to multiply ( X
that your answer gives you the correct result.

y= Ax , where y is (Y⃗ ) and x is (X


⃗)

[ ] [ ][ ]
2 0 1 0 0 1
1 1 0 0 0 2
Using only 1s and 0s to fill in matrix A: =
4 0 0 0 1 3
3 0 0 1 0 4

Matrix A is a permutation matrix which permutes the entries for x.

Question: From our earlier work, we know that the reflection of the image

[]
3
with matrix X about the y -axis would be Y = [ ]
3 1
4 2
⃗ 4
. So, ( Y )= . What matrix
1
2
⃗ ) by on the right in order to obtain ( Y⃗ ) ? Show
would we need to multiply ( X
that your answer gives you the correct result.

y= Ax , where y is (Y⃗ ) and x is (X


⃗)

[ ] [ ][ ]
3 0 0 1 0 1
4 0 0 0 1 2
Using only 1s and 0s to fill in matrix A: =
1 1 0 0 0 3
2 0 1 0 0 4

Matrix A is a permutation matrix which permutes the entries for x.


46

Blurring images
We can also blur images to get an effect we’re interested in, and we use
linear algebra to do it! The image on the left below is the picture, and the
image on the right is the blurred version.

One way to do this is to average each entry’s “neighbors” (including the


entry itself). The definition of these neighbors can be determined by the
user themselves. For example, a neighbor could be any entry in the matrix
representation that is directly left, right, above and below the original entry,
along with the entry itself.

[ ]
1 1 2
Example: Consider an image whose matrix representation is X = 2 1 1 .
3 1 2
Suppose we define a “neighbor” as an entry that is directly above, below,
next to or diagonal from that entry. For example, the entries that are
neighbors of x 31=3 in the matrix are x 21=2, x 22=1 , x 32=1, and x 31=3. So the
2+ 1+ 1+ 3 7
entry y 31 in the new matrix would be = .
4 4
47

[ ]
5/4 8/6 5/4
This gives us Y = 9 /6 14 /9 8 /6 .
7/ 4 10/6 5/4
48

⃗ ). Show
Challenge Question: Find the 9 x 9 matrix A such that Y = A∗(X
that your choice indeed results in Y .

[ ] []
1/4 1 /4 0 1/4 1 /4 0 0 0 0 1
1/6 1/6 1/6 1 /6 1/6 1/6 0 0 0 2
0 1 /4 1/4 0 1 /4 1/4 0 0 0 3
1/6 1/6 0 1 /6 1/6 0 1 /6 1/6 0 1
A= 1 /9 1/9 1/9 1 /9 1/9 1/9 1 /9 1/9 ⃗ )=
1/9 , ( X 1
0 1/6 1/6 0 1/6 1/6 0 1/6 1/6 1
0 0 0 1/4 1 /4 0 1/ 4 1 /4 0 2
0 0 0 1 /6 1/6 1/6 1 /6 1/6 1/6 1
0 0 0 0 1 /4 1/4 0 1 /4 1/4 2

*Note: the denominator of the fractions in matrix A are determined by the


number of neighbors the element has (example: element x 31 has 4 neighbors,
so in matrix A row 3 all has denominators of 4). The numerator will always
be 1. Place the appropriate fraction in the location that correlates to where
⃗ ).
the neighbors of that element are placed in (X
49

Lesson 4: (Extension) Image Processing using


Computer Science

Lesson Plan
Teacher: Subject:
This will be a teacher led activity Topic/Day: Using Python to Manipulate Photos
especially if students are not Content Objective: Use Matrices to solve real
familiar with Python. If students world problems.
have previous Python
programming experience they Materials Needed: Python notebook-nothing
could try the coding on their own. has to be downloaded but you will need to allow
“colab” to run as an extension in Google
Chrome to run the program.

Tim Student Does Teacher Does


e

Warm Up ~10 Write a matrix on paper of the Provide the image


Elicit/Engage
min image of the math symbols. either on the board or
Build relevance
a copy on paper.
through a problem
Try to find out what
your students already
know
Get them interested
Explore Explore putting the code in Provides code and
Connectivity to build ~45
understanding of Python to see how the images are scaffolding.
concepts min created and manipulated. (Code
Allow for collaboration will be provided.)
consider heterogeneous
groups
Move deliberately from
concrete to abstract
Apply scaffolding &
50

personalization
Explain ~30 Student should ask for help on Review the algorithms
Personalize/
Differentiate as needed min any of the previously taught for reflecting, rotating,
Adjust along matrix operations as needed. blurring and
teacher/student combining as needed.
centered continuum
Provide vocabulary
Clarify understandings
Evaluate N/A Final Code will be the assessment N/A
Summative-like
Assessment
Questions similar to
final assessment
51

Lesson 5: Instagram Project

Lesson Plan
Standard Topic/Day: Instagram Project
NC.M4.N.2.1 Execute procedures of Content Objective: Use matrices to manipulate and edit a photo to
post on Instagram
addition, subtraction, multiplication, Language Objective:
and scalar multiplication on matrices; Vocabulary:
NC.M4.N.2.2 Execute procedures of Materials Needed: Instagram Project printout, stock images printed,
poster board (or other arts and craft supplies for the students)
addition, subtraction, and scalar
multiplication on vectors.

PC.N.2.1 Execute the sum and


difference algorithms to combine
matrices of appropriate dimensions;
~85 minutes
PC.N.2.2 Execute associative and
distributive properties to matrices;
PC.N.2.3 Execute commutative
property to add matrices; PC.N.2.4
Execute properties of matrices to
multiply a matrix by a scalar;
PC.N.2.5 Execute the multiplication
algorithm with matrices.

DCS.N.1.1 Implement procedures of


addition, subtraction, multiplication,
and scalar multiplication on matrices;
DCS.N.1.2 Implement procedures of
addition, subtraction, and scalar
multiplication on vectors; DCS.N.1.3
Implement procedures to find the
inverse of a matrix; DCS.N.2.1
Organize data into matrices to solve
problems; DCS.N.2.2 Interpret
solutions found using matrix
operations in context; DCS.N.2.3
Represent a system of equations as a
matrix equation; DCS.N.2.4 Use
inverse matrices to solve a system of
52

equations with technology.

Time Student Does Teacher Does

Warm Up Provide the students with


Elicit/Engage
Build relevance through a problem the worksheet for the warm
Try to find out what your students Students will manipulate the image up and have them write the
already know ~25 provided (Lesson 5 – Warm Up) to matrix of the image. Then
Get them interested
mins reflect, blur, and brighten the image they would need to
manipulate the image and
draw the outcome for each
manipulation.

Explore Go over the outline and


Connectivity to build understanding
of concepts expectations with the
Allow for collaboration consider
heterogeneous groups students
Move deliberately from concrete to
abstract ~5 Review the Instagram project as a
Apply scaffolding & class Provide the students with
personalization mins
the necessary arts and
craft supplies for the
project to be completed

Explain Walk around the class


Personalize/Differentiate as needed
Adjust along listening to the
teacher/student centered
continuum ~45 conversations of students
Provide vocabulary Complete the Instagram project
Clarify understandings mins and facilitate conversations
and answer questions as
needed

Extend
Apply knowledge to new scenarios N/A
Continue to personalize as needed
Consider grouping homogeneously
N/A N/A

Evaluate ~10 Share their outcomes with their Facilitate the students
Formative Assessment
How will you know if students mins peers sharing their outcomes
understand throughout the lesson? with their peers

You can choose to do whole


group presentations or
partner groups and have
them share with only one
group at a time and do a
rotation (if you do this, be
sure to move around and
listen to each groups
presentation)

Recommended: Hang the


53

outcomes on the wall and


create a classroom
“Instagram feed” on the
wall. You can also have the
students give the photos
likes/comments and choose
a classroom influencer
based on the
likes/comments that each
photo receives.

Evaluate
Summative-like
Assessment N/A N/A N/A
Questions similar to final
assessment

Warm-Up – Teacher Version


Image Processing Name: ___________________________

Warm-Up Date: _________________Period: ____

Given the image below, write the corresponding matrix:

[ ]
255 255 255 0 0 255 255 255 255 255
0 0 255 255 0 0 0 255 255 255
255 0 255 255 255 0 0 255 255 255
255 0 0 255 0 0 0 0 255 255
255 255 0 0 0 0 0 0 0 255
A=
255 255 0 0 0 0 0 255 0 0
255 0 0 0 0 0 0 0 0 0
255 0 0 255 0 0 0 0 0 255
0 0 255 255 255 0 0 255 255 255
255 255 255 255 0 0 255 255 255 255

Reflect the image over the x-axis, write the new matrix, and draw the
new image:
54

[ ]
255 255 255 255 0 0 255 255 255 255
0 0 255 255 255 0 0 255 255 255
255 0 0 255 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 0
255 255 0 0 0 0 0 255 0 0
A=
255 255 0 0 0 0 0 0 0 255
255 0 0 255 0 0 0 0 255 255
255 0 255 255 255 0 0 255 255 255
0 0 255 255 0 0 0 255 255 255
255 255 255 0 0 255 255 255 255 255

Reflect the previous image over the y-axis, write the new matrix, and draw the new image:

[ ]
255 255 255 255 0 0 255 255 255 255
255 255 255 0 0 255 255 255 0 0
255 0 0 0 0 0 255 0 0 255
0 0 0 0 0 0 0 0 0 255
0 0 255 0 0 0 0 0 255 255
A=
255 0 0 0 0 0 0 0 255 255
255 255 0 0 0 0 255 0 0 255
255 255 255 0 0 255 255 255 0 255
255 255 255 0 0 0 255 255 0 0
255 255 255 255 255 0 0 255 255 255

Reflect the previous image over the 45⁰ line, write the new matrix, and draw the new image:

[ ]
255 0 255 255 255 255 255 255 0 255
255 0 0 0 255 255 0 0 0 255
255 255 255 0 0 0 0 0 255 255
0 255 255 255 0 0 0 255 255 255
0 0 255 0 0 0 0 0 255 0
A=
255 0 0 0 0 0 0 0 0 0
255 0 0 0 0 0 0 0 0 255
255 255 255 0 0 255 0 0 255 255
255 255 255 255 0 0 0 0 255 255
255 255 255 255 255 0 0 255 255 255
55

Change the brightness of the previous image by a scalar of 1/2, write the new matrix, and draw the
new image: *Note: you will use the color gray to draw the darkened or lightened image.

[ ]
255 255 255 255 255 255 255 255
0 0
2 2 2 2 2 2 2 2
255 255 255 255
0 0 0 0 0 0
2 2 2 2
255 255 255 255 255
0 0 0 0 0
2 2 2 2 2
255 255 255 255 255 255
0 0 0 0
2 2 2 2 2 2
255 255
0 0 0 0 0 0 0 0
A= 2 2
255
0 0 0 0 0 0 0 0 0
2
255 255
0 0 0 0 0 0 0 0
2 2
255 255 255 255 255 255
0 0 0 0
2 2 2 2 2 2
255 255 255 255 255 255
0 0 0 0
2 2 2 2 2 2
255 255 255 255 255 255 255 255
0 0
2 2 2 2 2 2 2 2

 Did you darken or lighten the image? Why?


o Darkened the image because 255 = white, and when the number gets closer to 0, then
the shade gets closer to black, so all of the white spaces turned gray.
Blur the original image and write the new matrix (you do not need to draw the new image):
[ ]
56

255 255 425


170 170 85 85 170 255 255
2 2 2
255 340 425 595
170 170 170 85 255 255
2 3 3 3
340 425 340 85 170 425 680
85 170 255
3 3 3 3 3 3 3
425 340 340 85 85 425
170 85 85 170
3 3 3 3 3 2
425 425 85 85 85 170 340 255
85 0
A= 2 3 3 3 3 3 3 2
425 425 170 85 85 170 85
0 0 0
2 3 3 3 3 3 2
340 170 85 85 85 85 170 85
170 0
3 3 3 3 3 3 3 2
340 85 85 170 340 255
85 85 85 85
3 3 3 3 3 2
255 425 340 170 425 595 425
170 170 85
2 3 3 3 3 3 2
255 425 425 255 255 425
170 85 255 255
2 2 2 2 2 2

*Image Source: [Link]


57

Instagram Project
 The project outline is in Appendix A
 There is an example of the Instagram Project in Appendix B
58

References and Additional Readings


 Allali, Mohamed. "Linear algebra and image
processing." International Journal of Mathematical Education in
Science and Technology 41.6 (2010): 725-741.

 Linear algebra and discrete image


processing [Link]
digital-image-processing-part-I

 Lecture notes for image processing and computer


vision [Link]
tureNotes/[Link]

 Bartkovich, K. G., Goebel, J. A., Graves, J. L., Teague, D. J., Barrett, G.


B., Compton, H. L., ... & Whitehead, K. (2000). Contemporary
Precalculus through Applications. New York: Glencoe/McGraw-Hill
 9:59
 Tan, S. (2002). Finite Mathematics for the Managerial, Life, and Social
Sciences (7th ed.). Boston: Brooks Cole.
59

Appendices

Appendix A: Lesson Materials – Student Versions

Lesson 1: Guided Notes – Student Version


 Student version begins on next page
60

Matrix Addition, Subtraction and Scalar Multiplication

A university is taking inventory of the books they carry at their two biggest
bookstores.
The East Campus bookstore carries the following books:
Hardcover: Textbooks-5280; Fiction-1680; NonFiction-2320; Reference-
1890
Paperback: Textbooks-1930; Fiction-2705; NonFiction-1560; Reference-
2130

The West Campus bookstore carries the following books:


Hardcover: Textbooks-7230; Fiction-2450; NonFiction-3100; Reference-
1380
Paperback: Textbooks-1740; Fiction-2420; NonFiction-1750; Reference-
1170

In order to work with this information, we can represent the inventory of each
bookstore using an organized array of numbers known as a matrix.

Definitions: A __________ is a rectangular table of entries and is used to


organize data in a way that can be used to solve problems. The following is a
list of terms used to describe matrices:
61

 A matrix’s ___________________________ is written by listing the number

of rows “by” the number of columns.

 The values in a matrix, A, are referred to as ______________ or

______________. The entry in the “mth” row and “nth” column is written

as a mn.

 A matrix is ______________ if it has the same number of rows as it has

columns.

 If a matrix has only one row, then it is a row ____________. If it has only

one column, then the matrix is a column ______________.

 The __________________ of a matrix, A, written AT, switches the rows

with the columns of A and the columns with the rows.

 Two matrices are _____________ if they have the same size and the same

corresponding entries.

The inventory of the books at the East Campus bookstore can be


represented with the following 2 x 4 matrix:
T FN R
Hardback [ ]
E= ¿
Paperback

Similarly, the West Campus bookstore’s inventory can be represented with


the following matrix:

T FN R
Hardback [ ]
W= ¿
Paperback

Adding and Subtracting Matrices


62

In order to add or subtract matrices, they must first be of the same


______________________. The result of the addition or subtraction is a matrix
of the same size as the matrices themselves, and the entries are obtained by
adding or subtracting the elements in corresponding positions.

In our campus bookstores example, we can find the total inventory between
the two bookstores as follows:

E+W =[ ¿ ] + [ ¿ ]

T FN R
Hardback [ ]
= ¿
Paperback
63

Question: Is matrix addition commutative (e . g . , A + B=B+ A)? Why or why


not?

Question: Is matrix subtraction commutative (e . g . , A−B=B−A )? Why or


why not?

Question: Is matrix addition associative (e . g . , ( A + B ) +C=A +(B+C ))? Why or


why not?

Question: Is matrix subtraction associative (e . g . , ( A−B )−C= A−(B−C))? Why


or why not?

Scalar Multiplication

Multiplying a matrix by a constant (or scalar) is as simple as multiplying


each entry by that number! Suppose the bookstore manager in East Campus
wants to double his inventory. He can find the number of books of each
type that he would need by simply multiplying the matrix E by the scalar (or
constant) 2. The result is as follows:
T FN R
Hardback [ ]
2 E=2∗[ ¿ ] = ¿
Paperback
64

Exercises: Consider the following matrices:

[ ] [ ] []
1 0 1 0 6 −21 5
A= 2 −4 3 B=[ 2 8 −6 ] C= 2 4 −9 D= −2
−6 1 8 5 −7 1 3

Find each of the following, or explain why the operation cannot be


performed:

b. A+ B b. B – A

c.A–C d. C – A

e. 5 B f. − A+ 4 C

g. B – D h. 2 C−6 A
65

i. BT + D

Lesson 2: Guided Notes – Student Version


 Student version begins on next page
66

Matrix Multiplication

The Metropolitan Opera is planning its last cross-country tour. It plans to


perform Carmen and La Traviata in Atlanta in May. The person in charge of
logistics wants to make plane reservations for the two troupes. Carmen has 2
stars, 25 other adults, 5 children, and 5 staff members. La Traviata has 3 stars,
15 other adults, and 4 staff members. There are 3 airlines to choose from.
Redwing charges round-trip fares to Atlanta of $630 for first class, $420 for
coach, and $250 for youth. Southeastern charges $650 for first class, $350 for
coach, and $275 for youth. Air Atlanta charges $700 for first class, $370 for
coach, and $150 for youth. Assume stars travel first class, other adults and staff
travel coach, and children travel for the youth fare.

Use multiplication and addition to find the total cost for each troupe to travel
each of the airlines.
67

It turns out that we can solve problems like these using a matrix operation,
specifically matrix multiplication!

We first note that matrix multiplication is only defined for matrices of certain
sizes. For the product AB of matrices A and B, where A is an m x n matrix, B
must have the same number of rows as A has columns. So, B must have size
¿¿ p . The product AB will have size ¿¿

Exercises

The following is a set of abstract matrices (without row and column labels):

[ ]
2 4 1
M= [ 1 −1
2 0 ]
N= 0 −1 3 O=
1 0 2
6
−1 [ ]

[ ] [] [
1
0 4
P=
−1
2
1
Q= 1 R=
3
3 1
−1 0 ]
2

[ ][][ ]
3 1 1
4 2 6 −1
1 0 2
S= T= U= 5 3 1 0
0 2 −3
0 2 −1 1
−1 1 4

List at least 5 orders of pairs of matrices from this set for which the product
is defined. State the dimension of each product.
68

Back to the opera…

Define two matrices that organize the information given:

stars adults children ¿ ¿ ¿


¿ ¿ ¿ [ ] Red South Air [ ¿ ] ¿
¿

We can multiply these two matrices to obtain the same answers we obtained
above, all in one matrix!

stars adults children ¿ ¿ ¿ Red South Air [ ¿ ] ¿


¿ ¿ ¿ [ ] ¿

¿ Red South Air ¿


¿

Carmen/Redwing:

Carmen/Southeastern:

Carmen/Air Atlanta:

La Traviata/Redwing:

La Traviata/Southeastern:

La Traviata/Air Atlanta:

Exercises2

2
Adapted from Bartkovich, K. G., Goebel, J. A., Graves, J. L., Teague, D. J., Barrett, G. B.,
Compton, H. L., ... & Whitehead, K. (2000). Contemporary Precalculus through
Applications. New York: Glencoe/McGraw-Hill
69

NC ND N

Bonds 13 25 22
Mort. 6 9 4
Loans 29 17 13

3. The K.L. Mutton Company has investments in three states - North


Carolina, North Dakota, and New Mexico. Its deposits in each state are
divided among bonds, mortgages, and consumer loans. The amount of
money (in millions of dollars) invested in each category on June 1 is
displayed in the table below.

The current yields on these investments are 7.5% for bonds, 11.25% for
mortgages, and 6% for consumer loans. Use matrix multiplication to find
the total earnings for each state.

1984 1985 1986


4. Several years Stock 68.0 72.00 75.0 ago, Ms. Allen
invested in A 0 0 growth stocks,
which she hoped Stock 55.0 60.00 67.5 would increase in
value over time. B 0 0 She bought 100
shares of stock A, Stock 82.5 84.00 87.0 200 shares of stock
B, and 150 shares C 0 0 of stock C. At the
end of each year she records the value of each stock. The table below
shows the price per share (in dollars) of stocks A, B, and C at the end of
the years 1984, 1985, and 1986.
70

Calculate the total value of Ms. Allen’s stocks at the end of each year.

3. The Sound Company produces stereos. Their inventory includes four


models - the Budget, the Economy, the Executive, and the President
models. The Budget needs 50 transistors, 30 capacitors, 7 connectors,
and 3 dials. The Economy model needs 65 transistors, 50 capacitors, 9
connectors, and 4 dials. The Executive model needs 85 transistors, 42
capacitors, 10 connectors, and 6 dials. The President model needs 85
transistors, 42 capacitors, 10 connectors, and 12 dials. The daily
manufacturing goal in a normal quarter is 10 Budget, 12 Economy, 11
Executive, and 7 President stereos.

a. How many transistors are needed each day? Capacitors? Connectors?


Dials?

b. During August and September, production is increased by 40%. How


many Budget, Economy, Executive, and President models are produced
daily during these months?

c. It takes 5 person-hours to produce the Budget model, 7 person-hours


to produce the Economy model, 6 person-hours for the Executive
model, and 7 person-hours for the President model. Determine the
number of employees needed to maintain the normal production
schedule, assuming everyone works an average of 7 hours each day.
How many employees are needed in August and September?
71

4. The president of the Lucrative Bank is hoping for a 21% increase in


checking accounts, a 35% increase in savings accounts, and a 52%
increase in market accounts. The current statistics on the number of
accounts at each branch are as follows:

Checkin Saving Market


g s

[ ]
Northgate 40039 10135 512
Downtown 15231 8751 105
South 25612 12187 97
What is Square the goal for
each branch in each type of account? (HINT: multiply by a 3 ×2 matrix
with certain nonzero entries on the diagonal and zero entries elsewhere.)
What will be the total number of accounts at each branch?
72

Lesson 3: Guided Notes – Student Version


 Student version begins on next page
73

Introduction to Image Processing Name:


___________________________
Part I: Image representation and processing Date: _______________
Period: ______

In this lesson, we will discuss representations of images and methods to


manipulate those images.

Figure: Image of a

Matrix representations:
 A grayscale image is a 2-dimensional array of numbers. An 8-bit

image has entries between ______ and _______.

 The value ______ represents a white color, and the value ______

represents a black color.

 Lower numbers translate to _____________ pixels, while higher

numbers translate to _____________ pixels.

 For an image that has m x n pixels (i.e., “picture elements”), we

represent that image using a matrix of size _____________. The entries

of the matrix indicate the pixel value of the corresponding part of the

image.

Example: This table represents an image that has 4 x5

pixels.
74

Example: This 4 x 4 image of the raccoon is represented by the matrix on


the right below:
75

Example: Write the matrix that represents the following image:


[ ¿ ] Exercis es:
1. Write a matrix that represents each of the following
images.

c.

d.

2. Draw a visual representation of the following matrices.

[ ]
0 255 255
0 255 255
d.
255 0 0
255 255 0

[ ]
0 255 255
e. 0 0 255
0 255 255

f. [ 2550 0 0
255 0 ]
Color Images:
76

Color images can be stored in a similar fashion to a grayscale image.


Instead of one number (0-255) per pixel, one stores three numbers per pixel
– these three numbers denote the “amount” of red, “amount” of green, and
“amount” of blue in each pixel. These three numbers can be used to depict a
wide range of colors.

Image transformations:
Once images are represented as matrices, we can describe many
transformations of those images using basic matrix operations!
Example: Suppose we have two separate images that can be represented by the

matrices A= [ 2550 0
]
255
and B=[ 0 0
255 0 ]
.

4. Draw the images that correspond to A and B.

5. Find and draw A+ B .

1
6. Compute C= A . How would you describe the image represented by C in
5
relation to the image represented by A ?
77

Note: When mathematical operations on images result in entries that range


outside of the integer values 0 through 255, image visualization tools treat them as
255 if the value exceeds 255, and as 0 if the value is below 0.

Exercises:
2. a. Describe an image whose matrix representation contains entries of all zeros.

b. Describe an image whose matrix representation contains entries of all 255.

3. Let A and B be matrices that represent two images of the same size.
Describe in words what each of the following means.
a. A−B b. 5 A + B

d. 255∗1− A , where “1” is the matrix of all 1’s


78
Part II: Manipulating images
Reflecting/rotating images
Let us consider how we might reflect an image over the x or y-axis. Here’s
an example!

How would we represent these reflections using matrices?


From our earlier work, we know that the image represented by the matrix
X=
[
255 0
0 255 ]
would be:

If we were to reflect this image about the x-axis, we would obtain:

[ 2550
The matrix X ' that represents this image is X =
0]
255
. We can generalize

this result!
Exercises:
1. Which matrix represents the image that is the reflection of the matrix

[ ]
0 a b 0
c d 0 0
A= ?
e 0 f g
0 0 0 h
1
2

2. Write the matrix that corresponds to the reflection of each of the


following about the
c. x−¿ axis
d. y−¿ axis

[ ] [ ]
0 255 255
0 255 255
b.
0 255 255
255 0 0
b. 0 0 255
0 255 255
c. [ 2550 0 0
255 0 ]
255 255 0

Reflecting images using matrix-matrix multiplication

Consider the matrix X = [ 12 34 ] that represents an image . 3

Question: From our work above, we know that the matrix representing the
image reflected about the x -axis is [ ¿ ] . What matrix would we need to
multiply X by on the left in order to obtain the matrix of the image reflected
about the x -axis? Show that your answer gives you the correct result.

3
(Note that these values each represent a shade of color between white and black, where 0
represents black, and 1 represents white. While we have used only values of 0 and 255 thus far, we
will use these values in this example to make the reflections clear.)
3

Question: From our work above, we know that the matrix representing the
image reflected about the y -axis is [ ¿ ] . What matrix would we need to
multiply X by on the right in order to obtain the matrix of the image
reflected about the y -axis? Show that your answer gives you the correct
result.

The matrix you used above is a form of a __________________________ matrix


(here referred to as a reverse identity matrix). This matrix is always
_____________, and its size is determined by the size of the matrix it is
multiplied to (i.e. in order for the matrix multiplication to be performed).

Exercises:

5. What size does the reverse identity matrix need to be to be used to


reflect an image represented by a 5 x 3 matrix about the x -axis? Why?

6. What size does the reverse identity matrix need to be to be used to


reflect an image represented by a 5 x 3 matrix about the y -axis? Why?
4

7. Use the reverse identity matrix of the appropriate size to reflect the
images represented by the following matrices about the x -axis.

[ ]
0 255 255
a. 0 0 255
0 255 255

[ ]
0 255 255
0 255 255
b.
255 0 0
255 255 0

c. [ 2550 0 0
255 0 ]
8. Use the reverse identity matrix of the appropriate size to reflect the
images represented by the following matrices about the y -axis.

[ ]
0 255 255
a. 0 0 255
0 255 255

[ ]
0 255 255
0 255 255
b.
255 0 0
255 255 0
5

c. [ 255 0 0
0 255 0 ]

Reflecting images using matrix-vector multiplication


We can also manipulate images using matrix-vector multiplication. This
method is a bit more powerful than matrix-matrix multiplication, because it
allows us with more flexibility in ways you can manipulate those images.

Using this method, we first convert our matrices into vectors (i.e., single
column or single row matrices).

 ⃗ ) as the vector conversion of the matrix X . In general, for


We define (X

[]

x1

X=
[ ⋮
x1
¿⋮
¿ ] ⃗ )=
x n ¿ ⋮ ¿ ¿⋮ ¿ , we have ( X …

.

xn

[]
 We define mat ( X ) as the matrix conversion of the vector Y . In general,

x1

for Y = … , we have mat ( X )=

⋮ ¿⋮
[
x ¿⋮ ¿¿ ⋮ ¿
x1 ¿ n ].
xn

Examples:

5. For X = [ 12 34 ], ( X⃗ )= ¿ .
[ ]
6

[ ]
1 4 7
⃗ )=[ ¿ ] .
6. For X = 2 5 8 , ( X
3 6 9

[]
3
5
7. For X = , mat ( X )=[ ¿ ].
6
1

[]
1
0
0
0
8. For X = 1 , mat ( X )=[ ¿ ].
0
0
0
1

Exercises:

3. Convert each of the following matrices into vectors.

a. A= [ 53 04 ] A ) =[ ¿ ] .
(⃗

b. B= [ 21 36] B )= [ ¿ ] .
(⃗

[ ]
8 8 8
c. C= 7 7 7 ⃗ )=[ ¿ ] .
(C
8 8 8

4. Convert each of the following vectors into matrices.


7

[]
3
5
a. X = mat ( X )=[ ¿ ]
6
1

[]
8
7
6
5
b. Y = 4 mat (Y )=[ ¿ ]
3
2
1
0
8

Reflection about the axes using matrix-vector multiplication

[]
1
Consider the matrix X = [ ]
1 3
2 4
⃗ 2
. We know that ( X )= .
3
4

Question: From our earlier work, we know that the reflection of the image

with matrix X about the x -axis would be Y = [ ]


2 4
1 3
. So, ( Y⃗ )= [ ¿ ]. What matrix
⃗ ) by on the left in order to obtain ( Y⃗ ) ? Show
would we need to multiply ( X
that your answer gives you the correct result.

Question: From our earlier work, we know that the reflection of the image

with matrix X about the y -axis would be Y = [ ]


3 1
4 2
. So, ( Y⃗ )= [ ¿ ]. What matrix
⃗ ) by on the right in order to obtain ( Y⃗ ) ? Show
would we need to multiply ( X
that your answer gives you the correct result.
9

Blurring images

We can also blur images to get an effect we’re interested in, and we use
linear algebra to do it! The image on the left below is the picture, and the
image on the right is the blurred version.

One way to do this is to average each entry’s “neighbors” (including the


entry itself). The definition of these neighbors can be determined by the
user themselves. For example, a neighbor could be any entry in the matrix
representation that is directly left, right, above and below the original entry,
along with the entry itself.

[ ]
1 1 2
Example: Consider an image whose matrix representation is X = 2 1 1 .
3 1 2
Suppose we define a “neighbor” as an entry that is directly above, below,
next to or diagonal from that entry. For example, the entries that are
neighbors of x 31=3 in the matrix are x 21=2, x 22=1 , x 32=1, and x 31=3. So the
2+ 1+ 1+ 3 7
entry y 31 in the new matrix would be = .
4 4

This gives us Y = [ 7 /4 ¿ ¿ ] .
10

⃗ ). Show
Challenge Question: Find the 9 x 9 matrix A such that Y = A∗(X
that your choice indeed results in Y .

Lesson 5: Warm-Up – Student Version


 Student version begins on next page
11

Image Processing Name: ___________________________

Warm-Up Date: _________________Period: ____

Given the image below, write the corresponding matrix:

A=[ ¿ ]

Reflect the image over the x-axis, write the new matrix, and draw the
new image:

A=[ ¿ ]

Reflect the previous image over the y-


axis, write the new matrix, and draw
the new image:

A=[ ¿ ]

Reflect the previous image over the 45⁰ line, write the new matrix, and
draw the new image:

A=[ ¿ ]

Change the brightness of the previous image by a scalar of 1/2, write


the new matrix, and draw the new image:
*Note: you will use the color gray to draw the darkened or lightened image.

A=[ ¿ ]

 Did you darken or lighten the


image? Why?

Blur the original image and write the new matrix (you do not need
to draw the new image):
12

A=[ ¿ ]

Lesson 5: Instagram Project Outline


 The outline begins on the next page
13

This Photo by Unknown Author is


Project
licensed under CC BY-SA
This Photo by Unknown Author is licensed under CC BY-SA

You are going to edit your given image to be Instagram ready! You will need to use
a combination of reflections, blurs, and brightness changes to post this image and
get LOTS of likes and comments.

Step 1:
● Come up with an Instagram handle (Note: all Instagram handles must be
school appropriate and approved by the teacher before you can choose your
image for step 2)
Step 2:
● Choose an image from your teacher to utilize throughout this project. First
come first serve, so be sure to pick your image quick!
Step 3:
● As a group, decide what types of reflections, inversions, and brightness
changes you would like to complete to post your picture. You MUST use one
of each type of edit!
Step 4:
● Create matrices and a new image for each edit that you complete. You will
need to turn this into your teacher at the end of the project.
Step 5:
● Once your edits are complete, you must come up with a perfect caption for
this photo (Note: all captions must be school appropriate).
o Remember, the better the caption, the more likely you are to receive
more likes and comments!
Step 6:
● Post your final image to the classroom Instagram feed on the wall and turn
in all other materials and work to your teacher.
14

o All other materials and work must be turned in in an organized


manner with the names of each group member on them.

Grading Rubric:
Potential Actual
What the teacher is looking for: Points Points
Earned Earned

1. Did the student follow the directions? 1

2. Does the student show understanding of how to


4
reflect the image?

3. Does the student show understanding of how to


4
invert an image?

4. Does the student show understanding of how to


4
adjust the brightness of an image?

5. Did the student complete their math correctly? 2

Total Points: 15
15

Appendix B: Lesson Materials – Templates/Examples

Lesson 4: Math Symbols Image


16

Lesson 5: Instagram Project Stock Images

* *

** **

** **
17

** **

** ***

*** ***

*Image Source: [Link]


**Image Source: [Link]
***Image Source: [Link]
18

Lesson 5: Instagram Project Exemplar


Instagram Handle: @mathpeeps314

Original Image:

[ ]
255 255 255 0 0 255 255 255 255 255
0 0 255 255 0 0 0 255 255 255
255 0 255 255 255 0 0 255 255 255
255 0 0 255 0 0 0 0 255 255
255 255 0 0 0 0 0 0 0 255
A=
255 255 0 0 0 0 0 255 0 0
255 0 0 0 0 0 0 0 0 0
255 0 0 255 0 0 0 0 0 255
0 0 255 255 255 0 0 255 255 255
255 255 255 255 0 0 255 255 255 255

Reflect the image over the x-axis:

[ ]
255 255 255 255 0 0 255 255 255 255
0 0 255 255 255 0 0 255 255 255
255 0 0 255 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 0
255 255 0 0 0 0 0 255 0 0
A=
255 255 0 0 0 0 0 0 0 255
255 0 0 255 0 0 0 0 255 255
255 0 255 255 255 0 0 255 255 255
0 0 255 255 0 0 0 255 255 255
255 255 255 0 0 255 255 255 255 255

Reflect the previous image over the y-axis:


19

[ ]
255 255 255 255 0 0 255 255 255 255
255 255 255 0 0 255 255 255 0 0
255 0 0 0 0 0 255 0 0 255
0 0 0 0 0 0 0 0 0 255
0 0 255 0 0 0 0 0 255 255
A=
255 0 0 0 0 0 0 0 255 255
255 255 0 0 0 0 255 0 0 255
255 255 255 0 0 255 255 255 0 255
255 255 255 0 0 0 255 255 0 0
255 255 255 255 255 0 0 255 255 255

Reflect the previous image over the 45⁰ line:

[ ]
255 0 255 255 255 255 255 255 0 255
255 0 0 0 255 255 0 0 0 255
255 255 255 0 0 0 0 0 255 255
0 255 255 255 0 0 0 255 255 255
0 0 255 0 0 0 0 0 255 0
A=
255 0 0 0 0 0 0 0 0 0
255 0 0 0 0 0 0 0 0 255
255 255 255 0 0 255 0 0 255 255
255 255 255 255 0 0 0 0 255 255
255 255 255 255 255 0 0 255 255 255

Change the brightness of the previous image by a scalar of 1/2, write the new matrix, and draw the
new image: *Note: you will use the color gray to draw the darkened or lightened image.

[ ]
1 ⋯ 1
Image Inversion – 255 ∙ ⋮ ⋱ ⋮ − A:
1 ⋯ 1

You might also like