2. Subsets of numbers
2
There are 5 basic subsets of numbers:
• Natural numbers (N)
• Integer numbers (Z)
• Rational numbers (Q)
• Real numbers (R)
• Complex numbers (C)
3. Subsets of numbers
3
Natural numbers (N)
• Sometimes called counting numbers
• Example: 0, 1, 2, 3, 4, 5, …..
Integers (Z)
• The integer numbers constitute of the natural numbers
and their negative values.
• Example: …., -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, …..
4. Subsets of numbers
4
Rational numbers (Q)
• Can be expressed as a fraction with an integer numerator and
an integer denominator.
• In rational numbers, the denominator can’t be zero.
• Example:
1
2
,
3
7
,
2
3
Irrational Numbers
• Numbers that cannot be written as a ratio of two integers
• Example: π, 2, 3
5. Subsets of numbers
5
Real numbers (R)
• Real numbers include all the rational and irrational numbers.
Complex numbers (C)
• The complex numbers consist of all numbers of the form
𝑎 + 𝑖𝑏
where a and b are real numbers, i = −1
6. Subclasses of the integers
6
Even and odd numbers
• An even number is an integer that is divisible by two without remainder.
• Any even number m has the form 𝑚 = 2𝑘 where k is an integer
• For odd numbers, the remainder is always 1 when dividing by two.
• Any odd number 𝑛 may be constructed by the formula 𝑛 = 2𝑘 + 1
7. Subclasses of the integers
7
Prime numbers
• A prime number is an integer greater than 1 that is not the product of
two smaller positive integers.
• Every natural number greater than 1 is either a prime itself or can be
factorized as a product of primes that is unique up to their order.
For example: 30 → 5×3×2
100 → 5×5×2×2
8. Error Analysis
8
Absolute error
Consider two values, as one being the true value (m) and the other is the
computed value (p).
Absolute Error (AE) is the absolute difference between the measured
value and the true value.
𝐴𝐸 = 𝑝 − 𝑚
Relative error
𝑅𝐸 =
𝑝 − 𝑚
𝑚
=
𝐴𝐸
𝑚
9. Error Analysis
9
Mean absolute error
Mean absolute error (MAE) is a measure of error between multiple
measurements.
𝑀𝐴𝐸 =
1
𝑛
𝑖=1
𝑛
𝑝𝑖 − 𝑚𝑖
Mean relative error
𝑀𝑅𝐸 =
1
𝑛
𝑖=1
𝑛
𝑝𝑖 − 𝑚𝑖
𝑚𝑖
10. Error Analysis
10
Square error
Square error (SE) between two measurements is the square of the
absolute error between the two measurements.
𝑆𝐸 = 𝑝 − 𝑚 2
Mean square error
𝑀𝑆𝐸 =
1
𝑛
𝑖=1
𝑛
𝑝𝑖 − 𝑚𝑖
2
11. Error Analysis
11
Root mean square error
Root mean square error (RMSE) is the most popular evaluation metric
used in error analysis.
𝑅𝑀𝑆𝐸 =
1
𝑛
𝑖=1
𝑛
𝑝𝑖 − 𝑚𝑖
2
12. Error Analysis
12
Example
Suppose that the output of a machine learning model is 23.7. Compute
the absolute and relative error for the model if the target value is 25.
Solution
Predicted value (computed value): p= 23.7
Target value (True value): m= 25
𝐴𝐸 = 𝑝 − 𝑚
𝐴𝐸 = 23.7 − 25 = 1.3
𝑅𝐸 =
𝑝 − 𝑚
𝑚
=
𝐴𝐸
𝑚
𝑅𝐸 =
1.3
25
= 0.052
13. A student made a new device which
used to measure the heart rate. He
recorded 10 measurements taken
from the new device and the
corresponding values which
measured with a calibrated device.
The measurements of the calibrated
device are taken as reference.
Example
13
Reading New device reading Reference value
1 88 88
2 107 104
3 78 78
4 100 99
5 68 67
6 107 108
7 83 82
8 88 85
9 93 91
10 78 78
Error Analysis
Compute MAE, MRE, and RMSE.
17. Solution of an equation
17
The solution of an equation is the value‐or values‐that a variable can take
on such that they make the equation true.
Example
Given the equation 4x - 8 = 4
The value x = 3 is a solution for this equation.
It is possible for an equation to have more than one solution. This occurs
when the degree of the polynomials used is not 1
Example
Given the equation 𝑥2
+ 6𝑥 = 16.
The solutions for this equation are 𝑥 = −8 and 𝑥 = 2
18. Solution of linear equations in one variable
18
Linear equations:
Degree (max power of the variable) =1
Solution Steps:
1. Carry out all distributions;
2. Regroup the variables on one side of the equal sign and the numbers
on the other;
3. Divide both sides by the coefficient of the variable.
𝟐𝒙 + 𝟑 = 𝟎 3(𝒙 + 𝟕) = 𝟓 𝟐 𝒙 + 𝟑 − 𝟏 = 𝟒𝒙
Ex.
19. Solution of linear equations in one variable
19
Example
Solve the equation
Solution
▪ Carry out all the distributions;
▪ Regroup the variables in one side
6𝑥 − 3𝑥 = 7 + 20
3𝑥 = 27
▪ Divide the two sides by the coefficient of the variable
3𝑥
3
=
27
3
𝑥 = 9
Thus, the solution for the equation is 𝑥 = 9
We can validate the solution by substituting 𝑥 = 9
in the equation
20. Solution of linear equations in one variable
20
Example
Solve the equation 6 2𝑥 + 3 + 𝑥 − 7 = 3 5𝑥 + 7 + 2𝑥
Solution
▪ Carry out all the distributions;
▪ Regroup the variables in one side
−4𝑥 = 10
▪ Divide the two sides by the coefficient of the variable
−4𝑥
−4
=
10
−4
𝑥 = −2.5
Thus, the solution for the equation is 𝑥 = −𝟐. 𝟓
12𝑥 + 18 + 𝑥 − 7 = 15𝑥 + 21 + 2𝑥
13𝑥 + 11 = 17𝑥 + 21
13𝑥 − 17𝑥 = 21 − 11