Matrices, arrays, and other table-like mathematical notation are marked up using `<mtable>`, `<mtr>`, and `<mtd>` elements. A matrix is a two-dimensional data set with columns and rows, where a column is a vertical representation of data and a row is a horizontal representation of data.

The `<mtable>` tag is used to draw matrices. The `matrix()` CSS function defines a homogeneous 2D transformation matrix, resulting in a `<transform-function>` data type. There are two main types of matrices:
- Square matrix: A matrix having an equal number of rows and columns. For example:
  B =
  ⎡ 1 2 3 ⎤
  ⎢ 0 1 4 ⎥
  ⎣ 0 6 1 ⎦
  B = [ 1 2 3, 0 1 4, 0 6 1 ]
- Rectangular Matrix: A matrix having an unequal number of rows and columns. For example:
  B =
  ⎡ 1 2 3 ⎤
  ⎢ 0 1 4 ⎥
  B = [ 1 2 3, 0 1 4 ]

In JavaScript, a matrix is an object wrapped around a regular JavaScript Array, providing utility functions for easy matrix manipulation such as subset, size, resize, clone, and more. Square brackets are commonly used to represent a matrix symbolically in matrices, with elements arranged in rows and columns within the brackets.

For coding matrices, they provide a way to see coding intersections between two lists of items in a project. For example, a coding matrix can be used to compare what small businesses and large businesses say about different forms of renewable energy.

To represent a matrix in mathematics symbolically, the elements of the matrix are arranged in the number of rows and the number of columns within the square brackets.

Note: The provided text included multiple unrelated topics and has been refined to focus on the main topic of matrices.


# 30 60 90 Solver

A 30 60 90 solver is a tool used to solve math problems, particularly those involving trigonometry. It can be found online or in math books. This solver helps to quickly and easily solve math problems, including word problems, which can be more challenging than arithmetic problems.

To solve word math problems, one needs to know the right formulas and be able to apply them. For example, if a man has 10 apples and 15 oranges, to find the total number of fruits, one would add the number of apples and oranges. However, the given example in the original text was incorrect, as it suggested multiplying the number of apples by 5 and then adding 15, which is not the correct approach.

Trigonometric equations, on the other hand, involve three numbers and can be used to solve both simple and complex problems. For instance, the equation 4x + 5 = 14 can be solved by subtracting 5 from 14 and then dividing the result by 4, not 2 as mentioned in the original text. The correct steps to solve a trig equation are:

1. Set up the equation by writing down all the numbers in the problem in order from least to greatest.
2. Identify the unknown number and the solution number.

Absolute value equations are another type of equation that compares two numbers and checks if they are equal. Absolute value is the difference between two numbers. To solve absolute value equations, one needs to know how to subtract numbers, including negative numbers, and use parentheses correctly.

When dealing with a specific equation, it is often possible to solve it by eliminating one of the variables. This process is called elimination. For example, if given the equation 2x + 3y = 7, one can eliminate the variable x by multiplying both sides by a number that makes the coefficient of x equal to 1, and then solving for y.

The elimination technique works in most cases, but it can get tricky when working with negative numbers. If an equation has both positive and negative numbers, one may need to perform some basic algebraic manipulations.

The 30 60 90 solver app has received positive reviews from users, who have found it to be helpful in solving math problems. The app provides step-by-step detailed explanations and has a photo feature that allows users to take a picture of a math problem and get the solution. Users have reported that the app has helped them solve problems they couldn't do on their own and has provided accurate results.


**Mathematical Statistics Books**

Records for legal professionals introduces students, teachers, practitioners, and judges to mathematical probability and statistics principles applied in law. The book includes real-world cases and studies where statistical evidence played a role.

**Probability, Statistics, and Truth**

This comprehensive study explores probability, its relation to statistical data, and its truth-finding value. It discusses the work of Pascal, Laplace, Poisson, and others, covering topics like the Law of Large Numbers and the Theory of Errors, with various examples.

**More Damned Lies and Statistics**

Joel Best's sequel to Damned Lies and Statistics continues his engaging and humorous account of how numbers are produced, used, and misused by researchers, journalists, and others.

**Stem-and-Leaf Display Examples**

Stem-and-leaf displays are used to represent data, such as in Problem 6-15, where cycles are measured in units of 100. The display shows the distribution of cycles, with stems representing hundreds and leaves representing ones.

**Confidence Intervals and Hypothesis Testing**

In statistics, confidence intervals estimate population parameters, while hypothesis testing evaluates claims about these parameters. For example, a 95% confidence interval for a mean might be (98.24, 101.76), indicating that the true mean is likely within this range.

**Multiple Choice Questions**

1. What is the primary purpose of a stem-and-leaf display?
a) To show the distribution of data
b) To calculate the mean of a dataset
c) To test a hypothesis about a population parameter
d) To create a confidence interval for a mean

Answer: a) To show the distribution of data

2. Which of the following is a correct interpretation of a 95% confidence interval?
a) There is a 95% chance that the true mean is within the interval
b) The interval will contain the true mean 95% of the time
c) The true mean is likely to be within the interval, but there is some uncertainty
d) The interval is useless because it is too wide

Answer: c) The true mean is likely to be within the interval, but there is some uncertainty

3. What is the difference between a parameter and a statistic?
a) A parameter is a characteristic of a sample, while a statistic is a characteristic of a population
b) A parameter is a characteristic of a population, while a statistic is a characteristic of a sample
c) A parameter is a type of statistical test, while a statistic is a type of data visualization
d) A parameter is a measure of central tendency, while a statistic is a measure of variability

Answer: b) A parameter is a characteristic of a population, while a statistic is a characteristic of a sample


Understanding your electricity costs when growing indoors is crucial to avoid unnecessary expenses. This guide provides a breakdown of the estimated total electricity costs for different types of grow lights and fans.

## CFL Electricity Calculations

The estimated total electricity cost for CFLs and fans is $27/month at $0.12/kWh and $59/month at $0.25/kWh.

- **Electricity Cost for CFLs:** $16/month at $0.12/kWh and $35/month at $0.25/kWh
  - Total hours: 558 light hours/month
  - CFL Wattage: 244W
- **Electricity Cost for Exhaust Fan:** $6/month at $0.12/kWh and $13/month at $0.25/kWh
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 68W
- **Electricity Cost for 2 Clip-On Fans:** $5/month at $0.12/kWh and $11/month at $0.25/kWh
  - Total hours: 744 fan hours
  - Total Wattage: 60W

## Starter LED Electricity Calculations

The estimated total electricity cost for LEDs and fans is $23/month at $0.12/kWh and $49/month at $0.25/kWh.

- **Electricity Cost for LED Grow Lights:** $12/month at $0.12/kWh and $25/month at $0.25/kWh (corrected to $26/month)
  - Total hours: 558 light hours/month
  - LED Grow Light Wattage: 185W
- **Electricity Cost for Exhaust Fan:** $6/month at $0.12/kWh and $13/month at $0.25/kWh
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 68W
- **Electricity Cost for 2 Clip-On Fans:** $5/month at $0.12/kWh and $11/month at $0.25/kWh
  - Total hours: 744 fan hours
  - Total Wattage: 60W

## 250W HPS Electricity Calculations

The estimated total electricity cost for a 250W grow light and fans is $33/month at $0.12/kWh and $69/month at $0.25/kWh.

- **Electricity Cost for MH/HPS Grow Light:** $17/month at $0.12/kWh and $35/month at $0.25/kWh
  - Total hours: 558 light hours/month
  - MH/HPS Grow Light Wattage: 250W
- **Electricity Cost for Exhaust Fan:** $11/month at $0.12/kWh and $23/month at $0.25/kWh
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 120W
- **Electricity Cost for 2 Clip-On Fans:** $5/month at $0.12/kWh and $11/month at $0.25/kWh
  - Total hours: 744 fan hours
  - Total Wattage: 60W

## LEC Electricity Calculations

The estimated total electricity cost for a 315W LEC grow light and fans is $29/month at $0.12/kWh and $58/month at $0.25/kWh.

- **Electricity Cost for 315 LEC Grow Light:** $21/month at $0.12/kWh and $44/month at $0.25/kWh
  - Total hours: 558 light hours/month
  - LEC Grow Light Wattage: 315W
- **Electricity Cost for Exhaust Fan:** $7/month at $0.12/kWh and $14/month at $0.25/kWh
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 75W

## 400W HPS Electricity Calculations

The estimated total electricity cost for a 400W grow light and fans is $96/month at $0.25/kWh.

- **Electricity Cost for MH/HPS Grow Light:** $56/month
  - Total hours: 558 light hours/month
  - MH/HPS Grow Light Wattage: 400W
- **Electricity Cost for Exhaust Fan:** $23/month
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 120W
- **Electricity Cost for 1 Clip-On Fan:** $6/month
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 30W
- **Electricity Cost for Oscillating Fan:** $11/month
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 55W

## 600W HPS Electricity Calculations

The estimated total electricity cost for a 600W grow light and fans is $128/month at $0.25/kWh.

- **Electricity Cost for MH/HPS Grow Light:** $84/month
  - Total hours: 558 light hours/month
  - MH/HPS Grow Light Wattage: 600W
- **Electricity Cost for Exhaust Fan:** $23/month
  - Total hours: 744 fan hours
  - Exhaust Fan Wattage: 120W
- **Electricity Cost for 2 Oscillating Fans:** $21/month
  - Total hours: 744 fan hours
  - Total Wattage: 110W


# Square Sides

If we enlarge the side of the square by a third, its circumference will be 20 cm larger than the original. What is the side of the square?

To solve this problem, we need to understand the relationship between the side length and the circumference of a square. The circumference of a square is given by the formula C = 4s, where s is the length of a side.

Let's denote the original side length as s. When we enlarge the side by a third, the new side length becomes s + (1/3)s = (4/3)s. The new circumference is then C' = 4 * (4/3)s = (16/3)s.

We are given that the new circumference is 20 cm larger than the original circumference, so we can set up the equation:

(16/3)s = 4s + 20

To solve for s, we can first multiply both sides of the equation by 3 to eliminate the fraction:

16s = 12s + 60

Subtracting 12s from both sides gives:

4s = 60

Dividing both sides by 4 gives:

s = 15

Therefore, the original side length of the square is 15 cm.

## Similar Problems

1. If the square side increases by 28%, the square circumference increases by 11.2 meters. Find the length of the original square side.

Let's denote the original side length as s. When the side increases by 28%, the new side length becomes s + 0.28s = 1.28s. The new circumference is then C' = 4 * 1.28s = 5.12s.

We are given that the new circumference is 11.2 meters larger than the original circumference, so we can set up the equation:

5.12s = 4s + 11.2

To solve for s, we can first subtract 4s from both sides:

1.12s = 11.2

Dividing both sides by 1.12 gives:

s = 10

Therefore, the original side length of the square is 10 meters.

2. If we enlarge the square side a = 5m, its area will increase by 10.25%. How many percent will the side of the square increase? How many percent will it increase the circumference of the square?

Let's denote the original side length as s = 5m. When the area increases by 10.25%, the new area becomes A' = 1.1025 * 5^2 = 1.1025 * 25 = 27.5625.

The new side length can be found by taking the square root of the new area:

s' = √27.5625 ≈ 5.25

The percentage increase in the side length is:

((5.25 - 5) / 5) * 100% ≈ 5%

The new circumference is C' = 4 * 5.25 = 21.

The percentage increase in the circumference is:

((21 - 20) / 20) * 100% = 5%

Therefore, the side of the square increases by 5%, and the circumference of the square also increases by 5%.

3. Rectangle - sides 3

If in the rectangle ABCD we enlarge the side a by 5 cm and decrease the side b by 2 cm, the rectangle area will be reduced by 5 cm². When we decrease the length of the side a by 4 cm and at the same time we increase the length of side b by 3 cm we increase the area by 12 cm². Find the original sides of the rectangle.

Let's denote the original side lengths as a and b. The original area is A = ab.

When we enlarge the side a by 5 cm and decrease the side b by 2 cm, the new area becomes A' = (a + 5)(b - 2) = ab + 5b - 2a - 10.

We are given that the new area is 5 cm² less than the original area, so we can set up the equation:

ab + 5b - 2a - 10 = ab - 5

Simplifying the equation gives:

5b - 2a = 5

When we decrease the length of the side a by 4 cm and at the same time we increase the length of side b by 3 cm, the new area becomes A'' = (a - 4)(b + 3) = ab + 3a - 4b - 12.

We are given that the new area is 12 cm² more than the original area, so we can set up the equation:

ab + 3a - 4b - 12 = ab + 12

Simplifying the equation gives:

3a - 4b = 24

Now we have two equations and two variables. We can solve for a and b by substitution or elimination.

Let's use substitution. Rearranging the first equation gives:

2a = 5b - 5

a = (5b - 5) / 2

Substituting this expression for a into the second equation gives:

3((5b - 5) / 2) - 4b = 24

Expanding and simplifying the equation gives:

15b - 15 - 8b = 48

7b = 63

b = 9

Now that we have found b, we can find a:

a = (5b - 5) / 2
= (5 * 9 - 5) / 2
= 40 / 2
= 20

Therefore, the original sides of the rectangle are a = 20 cm and b = 9 cm.

4. Ratio of sides

The triangle has a circumference of 21 cm and the length of its sides is in a ratio of 6:5:3. Find the length of the longest side of the triangle in cm.

Let's denote the lengths of the sides as 6x, 5x, and 3x. The circumference is the sum of the lengths of the sides:

6x + 5x + 3x = 21

Combining like terms gives:

14x = 21

Dividing both sides by 14 gives:

x = 1.5

Now that we have found x, we can find the lengths of the sides:

Longest side: 6x = 6 * 1.5 = 9 cm

Therefore, the length of the longest side of the triangle is 9 cm.

5. Rectangle diagonals

It is given rectangle with area 24 cm² and a circumference of 20 cm. The length of one side is 2 cm larger than the length of the second side. Calculate the length of the diagonal. Length and width are yet expressed in natural numbers.

Let's denote the length and width as l and w, respectively. The area is given by:

A = lw = 24

The circumference is given by:

C = 2l + 2w = 20

We are given that the length of one side is 2 cm larger than the length of the second side, so we can write:

l = w + 2

Substituting this expression for l into the equation for the circumference gives:

2(w + 2) + 2w = 20

Expanding and simplifying the equation gives:

4w + 4 = 20

Subtracting 4 from both sides gives:

4w = 16

Dividing both sides by 4 gives:

w = 4

Now that we have found w, we can find l:

l = w + 2
= 4 + 2
= 6

The diagonal can be found using the Pythagorean theorem:

d² = l² + w²
= 6² + 4²
= 36 + 16
= 52

d = √52
≈ 7.21

Therefore, the length of the diagonal is approximately 7.21 cm.

6. Square

If the length of the sides of the square we decrease by 25% decrease the content area of 28 cm². Determine the side length of the original square.

Let's denote the original side length as s. The original area is:

A = s²

When we decrease the side length by 25%, the new side length becomes:

s' = s - 0.25s
= 0.75s

The new area is:

A' = (0.75s)²
= 0.5625s²

We are given that the new area is 28 cm² less than the original area, so we can set up the equation:

s² - 0.5625s² = 28

Simplifying the equation gives:

0.4375s² = 28

Dividing both sides by 0.4375 gives:

s² = 64

s = √64
= 8

Therefore, the original side length of the square is 8 cm.

7. Parallelogram

Side a of parallelogram is twice longer than side b. Its circumference is 78 dm. Calculate the length of the sides of a parallelogram.

Let's denote the length of side b as x. Then, the length of side a is 2x.

The circumference of a parallelogram is given by:

C = 2a + 2b
= 2(2x) + 2x
= 4x + 2x
= 6x

We are given that the circumference is 78 dm, so we can set up the equation:

6x = 78

Dividing both sides by 6 gives:

x = 13

Now that we have found x, we can find the lengths of the sides:

Side b: x = 13 dm
Side a: 2x = 2 * 13 = 26 dm

Therefore, the lengths of the sides of the parallelogram are 13 dm and 26 dm.

8. Sides of triangle

Triangle has circumference 42 cm. Side a is 2 times shorter than side b and side c is 2 cm longer than side a. Determine the sizes of sides of a triangle.

Let's denote the length of side a as x. Then, the length of side b is 2x, and the length of side c is x + 2.

The circumference of a triangle is given by:

C = a + b + c
= x + 2x + (x + 2)
= 4x + 2

We are given that the circumference is 42 cm, so we can set up the equation:

4x + 2 = 42

Subtracting 2 from both sides gives:

4x = 40

Dividing both sides by 4 gives:

x = 10

Now that we have found x, we can find the lengths of the sides:

Side a: x = 10 cm
Side b: 2x = 2 * 10 = 20 cm
Side c: x + 2 = 10 + 2 = 12 cm

Therefore, the lengths of the sides of the triangle are 10 cm, 20 cm, and 12 cm.

9. The sides

The sides of a rectangle are in a ratio of 2:3, and its perimeter is 1 1/4 inches. What are the lengths of its sides? Draw it.

Let's denote the lengths of the sides as 2x and 3x. The perimeter is given by:

P = 2l + 2w
= 2(2x) + 2(3x)
= 4x + 6x
= 10x

We are given that the perimeter is 1 1/4 inches, so we can set up the equation:

10x = 1.25

Dividing both sides by 10 gives:

x = 0.125

Now that we have found x, we can find the lengths of the sides:

Length: 2x = 2 * 0.125 = 0.25 inches
Width: 3x = 3 * 0.125 = 0.375 inches

Therefore, the lengths of the sides of the rectangle are 0.25 inches and 0.375 inches.

10. Math heart

Stylized heart shape created from a square with side 5 cm and two semicircles over his sides. Calculate the content area and its circumference.

The area of the square is:

A = s²
= 5²
= 25 cm²

The area of each semicircle is:

A = (1/2)πr²
= (1/2)π(2.5)²
= (1/2)π(6.25)
≈ 9.82 cm²

The total area of the two semicircles is:

2 * 9.82 ≈ 19.64 cm²

The total area of the heart shape is:

25 + 19.64 ≈ 44.64 cm²

The circumference of the square is:

C = 4s
= 4 * 5
= 20 cm

The circumference of each semicircle is:

C = πr
= π(2.5)
≈ 7.85 cm

The total circumference of the two semicircles is:

2 * 7.85 ≈ 15.7 cm

The total circumference of the heart shape is:

20 + 15.7 ≈ 35.7 cm

Therefore, the content area of the heart shape is approximately 44.64 cm², and its circumference is approximately 35.7 cm.

11. Square into three rectangles

Divide the square with a side length of 12 cm into three rectangles with the same circumference so that these circumferences are as small as possible.

Let's denote the lengths of the sides of the rectangles as l and w. The circumference of each rectangle is:

C = 2l + 2w

We want to minimize the circumference, so we can set up the equation:

2l + 2w = C

We are given that the side length of the square is 12 cm, so we can set up the equation:

l + w = 12

Solving for w gives:

w = 12 - l

Substituting this expression for w into the equation for the circumference gives:

2l + 2(12 - l) = C

Expanding and simplifying the equation gives:

2l + 24 - 2l = C

C = 24

Now that we have found the circumference, we can find the lengths of the sides:

l + w = 12
l + (12 - l) = 12
l + 12 - l = 12
12 = 12

This equation is true for any value of l, so we can choose any value for l. Let's choose l = 4.

Then, w = 12 - l
= 12 - 4
= 8

The lengths of the sides of the rectangles are 4 cm and 8 cm.

12. MO-Z5-3-66 tiles

The picture shows a square tiles with side 10 dm which is composed of four identical small rectangles and squares. Circumference of small square is five times smaller than the circumference of the entire tile. Determine the dimensions of the rectangle.

Let's denote the side length of the small square as x. The circumference of the small square is:

C = 4x

The circumference of the entire tile is:

C = 4 * 10
= 40 dm

We are given that the circumference of the small square is five times smaller than the circumference of the entire tile, so we can set up the equation:

4x = (1/5) * 40

Simplifying the equation gives:

4x = 8

Dividing both sides by 4 gives:

x = 2

The side length of the small square is 2 dm.

The dimensions of the rectangle can be found by dividing the side length of the tile by the number of rectangles:

Length: 10 / 2 = 5 dm
Width: 10 / 4 = 2.5 dm

Therefore, the dimensions of the rectangle are 5 dm and 2.5 dm.

13. Triangle ABC

In a triangle ABC side b measure 10 cm less than the side a and side b is half of the side c. Calculate the length of sides if the circumference of the triangle is 42 cm.

Let's denote the length of side a as x. Then, the length of side b is x - 10, and the length of side c is 2(x - 10).

The circumference of a triangle is given by:

C = a + b + c
= x + (x - 10) + 2(x - 10)
= 4x - 30

We are given that the circumference is 42 cm, so we can set up the equation:

4x - 30 = 42

Adding 30 to both sides gives:

4x = 72

Dividing both sides by 4 gives:

x = 18

Now that we have found x, we can find the lengths of the sides:

Side a: x = 18 cm
Side b: x - 10 = 18 - 10 = 8 cm
Side c: 2(x - 10) = 2(18 - 10) = 2 * 8 = 16 cm

Therefore, the lengths of the sides of the triangle are 18 cm, 8 cm, and 16 cm.

14. Sides of triangle

Triangle circumference with two identical sides is 117cm. The third side measures 44cm. How many cms do you measure one of the same sides?

Let's denote the length of the two identical sides as x. The circumference of a triangle is given by:

C = a + b + c
= x + x + 44
= 2x + 44

We are given that the circumference is 117 cm, so we can set up the equation:

2x + 44 = 117

Subtracting 44 from both sides gives:

2x = 73

Dividing both sides by 2 gives:

x = 36.5

Therefore, the length of one of the identical sides is 36.5 cm.

15. Three sides

Side b is 2 cm longer than side c, side a is 9 cm shorter than side b. The triangle circumference is 40 cm. Find the length of sides a, b, c.

Let's denote the length of side c as x. Then, the length of side b is x + 2, and the length of side a is (x + 2) - 9 = x - 7.

The circumference of a triangle is given by:

C = a + b + c
= (x - 7) + (x + 2) + x
= 3x - 5

We are given that the circumference is 40 cm, so we can set up the equation:

3x - 5 = 40

Adding 5 to both sides gives:

3x = 45

Dividing both sides by 3 gives:

x = 15

Now that we have found x, we can find the lengths of the sides:

Side c: x = 15 cm
Side b: x + 2 = 15 + 2 = 17 cm
Side a: x - 7 = 15 - 7 = 8 cm

Therefore, the lengths of the sides of the triangle are 8 cm, 17 cm, and 15 cm.

16. Squares ratio

The first square has a side length of a = 6 cm. The second square has a circumference of 6 dm. Calculate the proportions of the perimeters and the proportions of the contents of these squares.

The perimeter of the first square is:

P = 4a
= 4 * 6
= 24 cm

The perimeter of the second square is:

P = 6 dm
= 60 cm

The ratio of the perimeters is:

P1 : P2 = 24 : 60
= 2 : 5

The area of the first square is:

A = a²
= 6²
= 36 cm²

The area of the second square is:

A = (P / 4)²
= (60 / 4)²
= 15²
= 225 cm²

The ratio of the areas is:

A1 : A2 = 36 : 225
= 4 : 25

Therefore, the proportions of the perimeters are 2:5, and the proportions of the contents are 4:25.

17. Triangle - is RT?

Triangle has a circumference of 90 cm. Side b is 1 cm longer than c, side c is 31 cm longer than side a. Calculate the length of sides and determine whether triangle is a right triangle.

Let's denote the length of side a as x. Then, the length of side c is x + 31, and the length of side b is (x + 31) + 1 = x + 32.

The circumference of a triangle is given by:

C = a + b + c
= x + (x + 32) + (x + 31)
= 3x + 63

We are given that the circumference is 90 cm, so we can set up the equation:

3x + 63 = 90

Subtracting 63 from both sides gives:

3x = 27

Dividing both sides by 3 gives:

x = 9

Now that we have found x, we can find the lengths of the sides:

Side a: x = 9 cm
Side c: x + 31 = 9 + 31 = 40 cm
Side b: x + 32 = 9 + 32 = 41 cm

To determine whether the triangle is a right triangle, we can use the Pythagorean theorem:

a² + c² = b²
9² + 40² = 41²
81 + 1600 = 1681
1681 = 1681

Since the equation is true, the triangle is a right triangle.


# Linear Regression

Linear regression is a fundamental concept in machine learning that involves finding a line that best fits a set of data points, allowing us to predict future points.

## Key Concepts

To master linear regression, it's essential to understand the following core concepts:

* **Gradient Descent**: an optimization algorithm used to find the best-fitting line.
* **Learning Rate**: the size of the step that gradient descent takes, which is crucial for achieving convergence. If the learning rate is too large, the algorithm will never reach the optimum, while a rate that's too small will take too much time to achieve the desired value.

## Linear Regression

The goal of linear regression is to find the slope (m) and intercept (b) pair that minimizes loss on average across all data points. This is achieved by iteratively updating the parameters m and b in the direction of the gradients, using the following formula to calculate the gradient of b:

\frac{2}{N}\sum_{i=1}^{N}…

The process involves taking a "step" in the direction of the gradient, with the step size proportional to the learning rate. The algorithm stops when it reaches **Convergence**, which occurs when the parameters m and b no longer change significantly.

## The Linear Regression Process

1. Initialize the parameters m and b.
2. Calculate the gradient of the loss function with respect to m and b.
3. Update the parameters m and b in the direction of the gradients, using the learning rate to determine the step size.
4. Repeat steps 2-3 until convergence is reached.

## Implementation

The linear regression algorithm can be implemented from scratch, but it's often more convenient to use a library like Python's scikit-learn, which provides an efficient and easy-to-use implementation.

## What You'll Create

By mastering linear regression, you'll be able to create portfolio projects that showcase your skills in machine learning and data analysis.

## How You'll Master It

You'll master linear regression by stress-testing your knowledge with quizzes and exercises that help commit the syntax and concepts to memory.


A) fraction
B) divide
C) decimal
D) None of the above
View Answer: Option – B.

State-run Bharat Sanchar Nigam (BSNL) unveiled its mobile wallet in partnership with a company to enable one-tap bill payment for its over 100 million subscribers.

In the number series 6, 15, 35, 63, 143, 221, 323, find the wrong number.

What is the Richest Municipal Corporation in India?

Arun, a cashew merchant, has 10kg sealed wooden boxes of cashews. The price increases by Rs.20 per kg annually, but 10% of the cashews are eaten by rodents each year. If the price of 1kg of fresh cashew is Rs.120, what is the change in profit if a sealed box is sold after one year instead of fresh?

A $15,000 loan has a 7% interest rate. Calculate the interest due and the amount repaid if the loan was taken out on April 7 and is due in seven months.

What is the Largest of all the Islands?

Who wrote the line: ‘A thing of beauty is a joy for ever’?

The relationship between the words "Fury" and "Ire" is to be identified. Select the pair with the same relationship from the given options.

The resolution of a printer is measured in what units?

The incomes of A and B are in the ratio 3:4. Each saves Rs.100 per month, and their expenditures are in the ratio 1:2. Find their incomes.


An introduction to differential geometry is provided, covering concepts necessary to understand automatic differentiation in modern machine learning frameworks. The discussion rigorously builds from topological spaces to the Jacobian-vector product and vector-Jacobian product, through smooth manifolds, tangent and cotangent spaces, and the notions of pullback and pushforward.

A three-part series on convolutional neural networks implemented using JAX + Flax is introduced, with the first part focusing on classifying the `stanford_dogs` dataset using the VGG19 net, achieving around 50% test accuracy. The JAX framework is built from the ground up in this introduction.

A dense version of Kruskal's algorithm is proposed, with a runtime of \(\Theta(n^2)\), outperforming the standard version's runtime of \(O(m \log m)\) when \(m \in \Theta(n^2)\). Experimentation shows similar runtime to Prim's algorithm for the dense case and improvement over the usual sparse version of Kruskal.

AVL trees are introduced as data structures for ordered element storage and retrieval, providing logarithmic insertion, removal, and retrieval, and linear traversal. An implementation in Haskell is discussed, with the height invariant of the tree known to hold at compile time.

Computing large terms of a linear recurrence with constant coefficients, like the Fibonacci sequence, modulo some number, is explored. The mathematics behind fast computation and programming aspects are discussed.

A generalized version of rock-paper-scissors with \(2n+1\) choices, \(n \ge 1\), is analyzed, along with a "best-of-three" playing rule. This is generalized to \(k\) victories, \(k \ge 1\).

Spectral clustering is introduced, with a link to a small C++ implementation. The formalism and mathematical motivation are discussed as a relaxation of an NP-hard problem, along with an example of its behavior on a typical dataset where \(k\)-means has bad behavior.

The boolean satisfiability problem (SAT) is discussed, with a focus on the boundary between P and NP as \(k\) increases in \(k\)-SAT, for \(1 \le k \le 3\). A proof that \(3\)-SAT is NP-complete is provided.

The mathematical concepts of variance and contravariance are explored in the context of programming language constructs.

Braess' paradox is introduced, showing that adding free edges to a network may increase the average cost to flow through the network. A classical example and the notion of the price of anarchy are discussed.

Graph representations are explored in a series of posts, starting with a brief summary and contrast of adjacency lists and matrices. The incidence matrix and adjacency matrix representations are discussed, along with their algebraic properties and theorems proved using these representations.

Dynamic programming is introduced using the classical knapsack problem, covering top-down and bottom-up dynamic programming, and a proof of optimality. Example code is provided in a mix of Python, pseudocode, and C.


The accounting equation is a fundamental concept in accounting that represents the relationship between a company's assets, liabilities, and equity. It is expressed as: Assets = Liabilities + Equity. This equation is the foundation of double-entry bookkeeping and is used to prepare financial statements.

The accounting equation can be used to calculate the value of any of the three components, given the values of the other two. For example, if a company's assets are $100,000 and its liabilities are $50,000, its equity can be calculated as: Equity = Assets - Liabilities = $100,000 - $50,000 = $50,000.

The accounting equation is also useful for analyzing the financial position of a company. By comparing the values of assets, liabilities, and equity, investors and analysts can gain insights into a company's financial health and make informed decisions.

In addition to the basic accounting equation, there are several other formulas and equations used in accounting, such as the calculation of accounting profit, which is: Accounting Profit = Revenue - Expenses.

Overall, the accounting equation is a powerful tool for understanding and analyzing financial information, and is a fundamental concept in the field of accounting.

Examples of Accounting Equation Formula:
Let’s take an example to understand the calculation of the Accounting Equation formula in a better manner.
Suppose a company has total assets of $100,000 and total liabilities of $40,000.
Using the formula we can calculate the equity as,
Equity = Assets – Liabilities
= $100,000 – $40,000
= $60,000

Therefore, the equity of the company is $60,000.

Similarly, we can calculate the assets and liabilities using the given values of equity and other components.

The balance sheet is set up to reflect the accounting equation (Assets = Liabilities + Shareholder Equity). To find shareholder equity, simply subtract liabilities from assets.


Constructing an Angle Congruent to a Given Angle
=====================================================

### Introduction

In true geometry constructions, only a straight edge and a compass are allowed. Using these tools, you can transfer an exactly congruent replica of any angle.

### Preparing Your Materials

1. **Review the original angle**: Begin with your sample angle on a sheet of paper, referred to as Angle ABC, with Point B as the vertex.
2. **Get a compass**: Any compass will work for copying an angle.
3. **Find a straightedge**: Avoid using a ruler; instead, use anything with a rigid straight edge.
4. **Use a pencil, pen, or other marking tool**: For drawing straight lines and marking lengths.

### Transferring a Congruent Angle

1. **Draw a ray**: Use the straight edge to draw a straight line starting at Point M, extending as long as desired, and label it Ray MN.
2. **Set the compass to a comfortable length**: Choose a setting that is easy to work with.
3. **Draw an arc on the original angle**: Set the compass at Point B and draw an arc crossing both Ray BA and Ray BC, marking the points where the arc crosses the rays as X and Y.
4. **Draw the same arc on the transfer angle**: Set the compass at Point M and draw an arc crossing Ray MN, labeling the point where the arc crosses Ray MN as F.
5. **Measure the XY distance**: Set the compass to the distance between Points X and Y.
6. **Copy the XY distance to the transfer angle**: Draw a new arc with Point F as the center, intersecting the previous arc at Point G.
7. **Complete the angle**: Draw a ray starting at M and passing through G, labeling it Ray ML.
8. **Review the completed angle**: The new angle, Angle LMN, should be an exact copy of the original Angle ABC.

### Community Q&A

* **What does congruent mean?**: For angles, it means having the same angular measure.
* **How does step 5 ensure the new angle will be congruent to the original angle?**: By transferring the same lengths and creating a congruent triangle, the new angle will be congruent to the original angle.

Note: The construction creates a congruent triangle, proving that the new angle is congruent to the original angle.


Quadratic equations have the general form $ax^2+bx+c$. These equations can have two real solutions, one real solution, or no real solution. There are several methods to solve quadratic equations, including the factoring method, the method of completing the square, and the general quadratic formula.

## Summary of Solving Quadratic Equations

Quadratic equations are characterized by their variables having a maximum power of 2, with the general form $ax^2+bx+c=0$. To solve these equations, different methods can be used depending on the equation. For incomplete quadratic equations of the form $ax^2+c=0$, isolate $x^2$ and take the square root of both sides. For incomplete quadratic equations of the form $ax^2+bx=0$, factor out $x$ and solve for $x$. For complete quadratic equations of the form $ax^2+bx+c=0$, use the factorization method or the general quadratic formula.

The general quadratic formula is:
$$x=\frac{-b\pm \sqrt{b^2-4ac}}{2a}$$

## 10 Quadratic Equations Examples with Solutions

### Example 1
Solve the equation $x^2-16=0$.
Solution: Isolate $x^2$ and take the square root of both sides:
$x^2=16$
$x=\pm \sqrt{16}$
$x=\pm 4$

### Example 2
Solve the equation $x^2-9x=0$.
Solution: Factor out $x$ and solve for $x$:
$x(x-9)=0$
$x=0$ or $x-9=0$
$x=0$ or $x=9$

### Example 3
Solve the equation $x^2-6x-7=0$.
Solution: Use factorization:
$(x-7)(x+1)=0$
$x-7=0$ or $x+1=0$
$x=7$ or $x=-1$

### Example 4
Solve the equation $x^2-8x+4=0$.
Solution: Use the quadratic formula:
$$x=\frac{-(-8)\pm \sqrt{(-8)^2-4(1)(4)}}{2(1)}$$
$$x=\frac{8\pm \sqrt{64-16}}{2}$$
$$x=\frac{8\pm \sqrt{48}}{2}$$
$x=7.46$ or $x=0.54$

### Example 5
Solve the equation $-x^2-5x+25=-2x^2+5x$.
Solution: Rewrite the equation in the form $ax^2+bx+c=0$:
$x^2-10x+25=0$
Use the quadratic formula:
$$x=\frac{-(-10)\pm \sqrt{(-10)^2-4(1)(25)}}{2(1)}$$
$$x=\frac{10\pm \sqrt{100-100}}{2}$$
$$x=\frac{10\pm \sqrt{0}}{2}$$
$x=5$

### Example 6
Solve the equation $4x^2+5=2x^2+20$.
Solution: Simplify and rewrite the equation in the form $ax^2+bx+c=0$:
$2x^2-15=0$
Isolate $x^2$ and take the square root of both sides:
$2x^2=15$
$x^2=\frac{15}{2}$
$x=\pm \sqrt{\frac{15}{2}}$

### Example 7
Solve the equation $(3x+1)(2x-1)-(x+2)^2=5$.
Solution: Expand and simplify:
$6x^2-x-1-(x^2+4x+4)=5$
$5x^2-5x-5=5$
$5x^2-5x-10=0$
Use factorization:
$5(x^2-x-2)=0$
$5(x+1)(x-2)=0$
$x+1=0$ or $x-2=0$
$x=-1$ or $x=2$

### Example 8
Show that the equation $5x^2+4x+10=0$ has no real solutions.
Solution: Use the quadratic formula:
$$x=\frac{-(4)\pm \sqrt{(4)^2-4(5)(10)}}{2(5)}$$
$$x=\frac{-4\pm \sqrt{16-200}}{10}$$
$$x=\frac{-4\pm \sqrt{-184}}{10}$$
Since $\sqrt{-184}$ is not a real number, the equation has no real roots.

### Example 9
Solve the equation $\frac{2x+1}{x+5}=\frac{3x-1}{x+7}$.
Solution: Cross-multiply and simplify:
$(2x+1)(x+7)=(3x-1)(x+5)$
$2x^2+15x+7=3x^2+14x-5$
$x^2-x-12=0$
Use factorization:
$(x+3)(x-4)=0$
$x+3=0$ or $x-4=0$
$x=-3$ or $x=4$

### Example 10
Find two numbers with a sum of 17 and a product of 60.
Solution: Let $X$ and $Y$ be the numbers, with $X+Y=17$ and $XY=60$.
Substitute $Y=17-X$ into the second equation:
$X(17-X)=60$
Expand and rewrite in the form $ax^2+bx+c=0$:
$17X-X^2=60$
$X^2-17X+60=0$
Use factorization:
$(X-12)(X-5)=0$
$X-12=0$ or $X-5=0$
$X=12$ or $X=5$
The numbers are 12 and 5.


About two years ago, I discovered an impressive design by Steve Portz on Thingiverse. Today, we revisited this idea, starting with a discussion about the volume of a cylinder.

The next step involved finding the volume of a cone. To introduce this concept, we first explored the volume of a pyramid using snap cubes. The key idea here is the factor of 3 in the division, which was initially misunderstood.

We then examined pyramid shapes from previous projects, demonstrating how three or six pyramids can form a cube. This part of the discussion was more successful. These ideas led us to hypothesize the volume formula for a cone.

With the volume formulas for cones and cylinders established, we used a 3D print to guess the volume formula for a sphere. After laying this groundwork, we attempted to pour water through the print, which worked nearly perfectly.

The 3D print, designed by Steve Portz, is an excellent tool for exploring elementary 3D geometry concepts in a fun and interactive way.


# Improvising Float Division in Tableau

## The Problem

Tableau 9.3 lacks a built-in function for dividing two floats. The only available division function is DIV(integer, integer), which returns the integer portion of the quotient. To divide two floats with three decimal places, we need to simulate float division using integer division and obtain both the integer and non-integer portions of the quotient.

## Test Variables

We have two float variables:
- a = 5.502
- b = 2.437
The quotient of a and b to three decimal places is 2.258.

## Solution

### Approach 1: Casting to Integers

Using Tableau's built-in DIV function by casting a and b to integers:
DIV(INT(a), INT(b)) = DIV(INT(5.502), INT(2.437)) = DIV(6, 2) = 3
This approach is problematic due to information loss during integer conversion, resulting in an inaccurate answer.

### Approach 2: Using MOD and FLOOR Operations

Applying MOD and FLOOR operations:
DIV(INT(FLOOR(a)), INT(FLOOR(b))) + MOD(a, b) = DIV(INT(FLOOR(5.502)), INT(FLOOR(2.437))) + MOD(5.502, 2.437) = DIV(5, 2) + MOD(5.502, 2.437) = 2 + 0.628 = 2.628
The error lies in the fractional part of the result, as MOD returns the remainder as a raw value rather than as a portion of the quotient.

### Approach 3: Multiplying by 10^x

Multiplying the dividend by 10^3, performing the division, and then multiplying the result by 10^-3:
DIV(INT(a * 10^3), INT(b)) * 10^-3 = DIV(INT(5.502 * 10^3), INT(2.437)) * 10^-3 = DIV(INT(5502), INT(2437)) * 10^-3 = 2258 * 10^-3 = 2.258
This approach successfully simulates float division using integer division and returns both the integer and non-integer portions of the quotient.

## TL/DR

Tableau 9.3 only allows integer division. To perform a division operation between two floats, multiply the dividend by 10^x before dividing (where x is the precision of the floats). After performing the division, multiply the result by 10^-x.


## The Inverse of a 2x2 Matrix

The inverse of a 2x2 matrix is a matrix that, when multiplied by the original matrix, results in the identity matrix. In this lesson, we will learn how to find the inverse of a 2x2 matrix using a formula and how to apply it to solve problems.

### How to Find the Inverse of a 2x2 Matrix

To find the inverse of a 2x2 matrix $X$, we use the formula:

$X^{-1} = \frac{1}{ad - bc} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}$

where $X = \begin{bmatrix} a & b \\ c & d \end{bmatrix}$.

This formula is derived from the fact that the product of a matrix and its inverse is the identity matrix. We can verify this by multiplying the matrix $X$ by its inverse $X^{-1}$:

$XX^{-1} = \begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

### Inverse of a 2x2 Matrix Proof

To prove that the formula for the inverse of a 2x2 matrix is correct, we can use an example. Let $A = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix}$. First, we need to find the determinant of $A$:

$det(A) = 2(4) - 1(3) = 8 - 3 = 5$

Since the determinant is not zero, $A$ is invertible. Now, we can find the inverse of $A$ using the formula:

$A^{-1} = \frac{1}{5} \begin{bmatrix} 4 & -1 \\ -3 & 2 \end{bmatrix}$

We can verify that $A^{-1}$ is indeed the inverse of $A$ by multiplying them together:

$AA^{-1} = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 4 & -1 \\ -3 & 2 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

### Exercise Problems

#### Example 1

Using the matrices $X = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$ and $Y = \begin{bmatrix} 4 & -2 \\ -3 & 1 \end{bmatrix}$, check if they are inverses.

$XY = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 4 & -2 \\ -3 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

Therefore, $X$ and $Y$ are inverses.

#### Example 2

Using the matrices $A = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix}$ and $B = \begin{bmatrix} 4 & -1 \\ -3 & 2 \end{bmatrix}$, check if they are inverses.

$AB = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 4 & -1 \\ -3 & 2 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

Therefore, $A$ and $B$ are inverses.

#### Example 3

Using the matrices $A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$ and $B = \begin{bmatrix} 4 & -2 \\ -3 & 1 \end{bmatrix}$, check if they are inverses.

$AB = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 4 & -2 \\ -3 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

Therefore, $A$ and $B$ are inverses.

#### Example 4

Find the inverse of the matrix $X = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix}$.

$X^{-1} = \frac{1}{2(4) - 1(3)} \begin{bmatrix} 4 & -1 \\ -3 & 2 \end{bmatrix} = \frac{1}{5} \begin{bmatrix} 4 & -1 \\ -3 & 2 \end{bmatrix}$

#### Example 5

Find the inverse of the matrix $A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$.

$A^{-1} = \frac{1}{1(4) - 2(3)} \begin{bmatrix} 4 & -2 \\ -3 & 1 \end{bmatrix} = \frac{1}{-2} \begin{bmatrix} 4 & -2 \\ -3 & 1 \end{bmatrix} = \begin{bmatrix} -2 & 1 \\ \frac{3}{2} & -\frac{1}{2} \end{bmatrix}$

#### Example 6

Find the inverse of the matrix $F = \begin{bmatrix} 2 & 3 \\ 4 & 5 \end{bmatrix}$.

$F^{-1} = \frac{1}{2(5) - 3(4)} \begin{bmatrix} 5 & -3 \\ -4 & 2 \end{bmatrix} = \frac{1}{-2} \begin{bmatrix} 5 & -3 \\ -4 & 2 \end{bmatrix} = \begin{bmatrix} -\frac{5}{2} & \frac{3}{2} \\ 2 & -1 \end{bmatrix}$

#### Example 7

Find the inverse of the identity matrix $C = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$.

Since the identity matrix is its own inverse, $C^{-1} = C = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$.

Note: The identity matrix is an involutory matrix, meaning that it is its own inverse. This can be verified by multiplying the identity matrix by itself:

$CC = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

Using the formula for the inverse of a 2x2 matrix, we can also verify that the inverse of the identity matrix is indeed the identity matrix itself:

$C^{-1} = \frac{1}{1(1) - 0(0)} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$


### Problem 2-68

Set up a four-quadrant graph on grid paper with x- and y-axes. Draw a triangle with vertices, then translate it left by 2 units and down by 3 units. Label this new triangle A and list its vertices.

Next, reflect the original triangle T across the x-axis. Label this reflected triangle B and list its vertices. Determine if triangles T, A, and B are congruent, meaning they have the same shape and size. Explain your reasoning.

When translating or reflecting the original triangle, consider whether its size or shape changed. Explore this problem further using the provided eTool.


In traditional geometry, a polygon is a 2-dimensional, flat shape enclosed by straight line segments. These segments are referred to as its edges or sides, and where they meet are known as its vertices or corners. The interior of the polygon is its body. The term "polygon" is derived from Greek words "polús" (much, many) and "g?nía" (corner or angle).

To qualify as a polygon, the angle between two edges must not be 180°. Polygons can be classified based on the number of sides.

**Types of Polygons**

* **Triangle**: A polygon with 3 vertices and 3 sides, symbolized as ABC.
* **Quadrilateral**: A polygon with 4 sides and 4 vertices, which can be simple (concave or convex, non-self-intersecting) or complex (self-intersecting, crossed).
* **Pentagon**: A polygon with 5 sides and 5 vertices, which can be simple or self-intersecting (e.g., a pentagram), with internal angles summing to 540°.
* **Hexagon**: A polygon with 6 sides and 6 vertices, with internal angles summing to 720° and a Schläfli symbol {6}.
* **Heptagon**: A polygon with 7 sides and 7 vertices, with a Schläfli symbol {7} and internal angles summing to 900° in a regular heptagon.
* **Octagon**: A polygon with 8 sides and 8 vertices, with a Schläfli symbol {8} and internal angles of 135° each, summing to 1080°.
* **Nonagon**: A polygon with 9 sides and 9 vertices, also known as an enneagon, with internal angles summing to 1260°.
* **Decagon**: A polygon with 10 sides and 10 vertices, with a Schläfli symbol {10} and internal angles of 144° each, summing to 1440°.
* **Dodecagon**: A polygon with 12 sides and 12 vertices, with a Schläfli symbol {12} and internal angles of 150° each, summing to 1800°.

Each type of polygon has unique properties and characteristics, including the sum of internal angles and the number of sides and vertices.


Q: How many lines of symmetry does a trapezoid have?
A: A trapezoid has 1 line of symmetry, unless it's in the form of an isosceles trapezoid, which has 1 line of symmetry, or a rectangle, which has 2 lines of symmetry.

Related concepts:
- A rectangle has 2 lines of symmetry: one horizontal and one vertical, both passing through the center.
- A scalene triangle has no lines of symmetry because all its sides and angles are different.
- A square has 4 lines of symmetry.
- A coral reef, as a biome, shows no symmetry.
- Bilateral symmetry refers to the presence of one line of symmetry that divides a shape into two mirror-image halves.

Note: The number of lines of symmetry in a shape depends on its type and properties. For example:
- An isosceles triangle may have 1 line of symmetry.
- A triangle may have 1, 2, or no lines of symmetry, depending on its type.
- A rectangle always has 2 lines of symmetry.


**Dynamic Programming**

Dynamic programming is a methodology for designing algorithms. We'll discuss examples to illustrate this methodology.

**Problem 1: Longest Increasing Subsequence (LIS)**

Input: A sequence of numbers.
Output: The length of the LIS.

Example: For the input sequence, the longest increasing subsequence is.

To design a dynamic programming algorithm, we first define a subproblem. We then attempt to define a recursive solution to the subproblem in terms of smaller subproblems.

**Attempt 1:**

* Subproblem definition: Let be the length of the LIS in the prefix of the input.
* Recursive step: We want to express in terms of. However, given, we need to know the last number in the optimal subsequence for to determine if we can append onto it.

**Attempt 2:**

* Subproblem definition: Let be the length of the LIS in the prefix of the input that includes.
* Recursive step: .
* Output: Return.

**Pseudocode:**

* for
* for
* if then
* for
* for
* if then
* Return .

**Running time:**. We have subproblems, and each subproblem depends on all the subproblems before it.

Note: The subproblem definition enforces the inclusion of element, allowing us to know when we can extend this subproblem.

**Problem 2: Longest Common Subsequence**

Given two strings and, find the length of the longest string that is a subsequence of both and.

**Example:**

The length of the longest common subsequence is 4, and the string is.

**Dynamic Programming Solution:**

We define the subproblem as follows:

For, , let denote the length of the longest common subsequence for the strings and.

Base cases:

Recurrence:

If characters and are different:
If, then:

If characters and match:
If, then:

**Pseudocode:**

* for to
* for to
* for to
* for to
* if :
* if :

* for to
* return

**Running time:**.

Practice exercises:

1. How do you find the LCS (not just the length, but output a string)?
2. Longest common substring (instead of subsequence).