You are on page 1of 14

American University of Science & Technology Faculty of Arts and Sciences

Faculty of Arts and Sciences


Department of Mathematics

MAT 204 – Discrete Mathematics

Names: -Jean Yazbek


-Mohamad Azakir

Title: Mathematical induction /Java program to find Union and intersection of two sets.

Course Instructor: Ms. Nicole Issa

Section: A
Outline

1. History

2. Type of proofs

3. Mathematical induction

4. Usage of mathematical induction in real life

5. Summary and conclusion

6. Reference

7. JAVA Program.
History

Plausibility arguments using heuristic devices such as pictures and analogies


preceded strict mathematical proof.[7] It is likely that the idea of demonstrating a
conclusion first arose in connection with geometry, which originally meant the
same as "land measurement".[8] The development of mathematical proof is
primarily the product of ancient Greek mathematics, and one of the greatest
achievements thereof. Thales(624–546 BCE) and Hippocrates of Chios (c. 470–
410 BCE) proved some theorems in geometry. Eudoxus (408–355 BCE)
and Theaetetus (417–369 BCE) formulated theorems but did not prove
them. Aristotle(384–322 BCE) said definitions should describe the concept being
defined in terms of other concepts already known. Mathematical proofs were
revolutionized by Euclid (300 BCE), who introduced the axiomatic method still in
use today, starting with undefined terms and axioms (propositions regarding the
undefined terms assumed to be self-evidently true from the Greek "axios" meaning
"something worthy"), and used these to prove theorems using deductive logic. His
book, the Elements, was read by anyone who was considered educated in the West
until the middle of the 20th century.[9] In addition to theorems of geometry, such as
the Pythagorean theorem, the Elements also covers number theory, including a
proof that the square root of two is irrational and that there are infinitely many
prime numbers.
Further advances took place in medieval Islamic mathematics. While earlier Greek
proofs were largely geometric demonstrations, the development
of arithmetic and algebra by Islamic mathematicians allowed more general proofs
that no longer depended on geometry. In the 10th century CE,
the Iraqi mathematician Al-Hashimi provided general proofs for numbers (rather
than geometric demonstrations) as he considered multiplication, division, etc. for
"lines." He used this method to provide a proof of the existence of irrational
numbers.[10] An inductive proof for arithmetic sequences was introduced in the Al-
Fakhri(1000) by Al-Karaji, who used it to prove the binomial theorem and
properties of Pascal's triangle. Alhazen also developed the method of proof by
contradiction, as the first attempt at proving the Euclideanparallel postulate.[11]
Modern proof theory treats proofs as inductively defined data structures. There is
no longer an assumption that axioms are "true" in any sense; this allows for parallel
mathematical theories built on alternate sets of axioms (see Axiomatic set
theory and Non-Euclidean geometry for examples).

Type of proofs

1) Direct proof: Many theorems are implication of the form p→q if p then q.
Assume p is true and you show q is true T→T true.

Sometimes the negation of a proposition is easier to state so we use the


indirect or the proof by contradiction.

2) Indirect Proof:

p→q ⇔ ¬q → ¬p

We prove ¬q → ¬p true using the direct proof then p→q will be true.

3) Mathematical Induction:

I- first principle: A proof by mathematical induction that p(n) is true for


every positive integer n consists of 2 steps:

The basic step: we prove that p (1) is true

Induction step: Assume p(n) true, we prove p(n+1) true then p(n) is true for
all x ⇒ p(n)→ p(n+1).

II- Second Principle of mathematical Induction

Basic step: prove P (1) true

Induction step: Assume p(k) true K 1→n


Mathematical induction

The simplest and most common form of mathematical induction infers that a
statement involving a natural number n holds for all values of n. The proof consists
of two steps:

1. The base case: prove that the statement holds for the first natural number n0.
Usually, n0 = 0 or n0 = 1; rarely, but sometimes conveniently, the base value
of n0 may be taken as a larger number, or even as a negative number (the
statement only holds at and above that threshold), because these extensions
do not disturb the property of being a well-ordered set.

2. The step case or inductive step: prove that for every n ≥ n0, if the statement
holds for n, then it holds for n + 1. In other words, assume the statement
holds for some arbitrary natural number n ≥ n0, and prove that then the
statement holds for n + 1.

The hypothesis in the inductive step, that the statement holds for some n, is called
the induction hypothesis or inductive hypothesis. To prove the inductive step,
one assumes the induction hypothesis and then uses this assumption, involving n,
to prove the statement for n + 1.
Whether n = 0 or n = 1 is taken as the standard base case depends on the preferred
definition of the natural numbers. In the fields of combinatorics and mathematical
logic it is common to consider 0 as a natural number.

The method of mathematical induction for proving results is very important in the
study of Stochastic Processes. This is because a stochastic process builds up one
step at a time, and mathematical induction works on the same principle.
Usage of mathematical induction in real life

1)I'll start with the standard example of falling dominoes. In a line of closely
arranged dominoes, if the first domino falls, then all the dominoes will fall
because if any one domino falls, it means that the next domino will fall, too.

2) I will leave this question unanswered. There are lots of solutions on the web for
this, if you don't get it.
Consider a long circular road that has several fuel depots along the way. All in all,
the depots contain just the right amount of fuel to get your car around. You start
with an empty tank. Show that you can always find a depot at which to start so
that it's possible to get all the way round. (You can make the road one-way if you
like.)

3) Another example is the solution to the tower of Hanoi and other similar
problems (see sources). Although there are several other proofs, induction is the
most common and elegant of them all.

4) You are in line at Taco Bell. The first person in line orders a cheesy crunch.
Also, if the person in front of you orders a cheesy crunch, you order it too,
because it sounds so good. How many people in line order cheesy crunches? ;)

5) A truly real-life example is the sinking of the Titanic: The crew of the Titanic
realized that the ship was doomed when they realized that the bulkhead that was
being flooded would be completely flooded, and that when a given bulkhead was
completely flooded, the next bulkhead would undergo the same fate, thus sinking
the whole ship.

6) Finally, an awesome puzzle on the lines of induction is the Common


knowledge
Summary and conclusion

Mathematical induction is a technique for proving something is true for


proving something is true for all integers starting from a small one, usually 0
or 1 .A proof consists of three parts prove it for the base case, assume it for
some integer k, with that assumption show it holds for k + 1. It can be used
for complexity, correctness and analyses. while we still think this is correct,
math induction does loosely resemble empirical induction. From a formal
point of view, there is a tension between math induction and the usual
constraint that proofs be finite. Math induction seems to rely on an infinite
process of iterating through the natural numbers.
Reference

https://cpb-us-e1.wpmucdn.com/sites.northwestern.edu/dist/4/1328/files/2017/05/mathinduct3a-
1ph0lrp.pdf

https://www.stat.auckland.ac.nz/~fewster/325/notes/ch5annotated.pdf

JAVA Program:
Code:

import javax.swing.JOptionPane;
import java.io.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class Discrete
{
// Function to find intersection
static void intersection(int a[], int b[])
{
System.out.println("Intersection of the two sets is :");
for(int i = 0; i<a.length; i++ )
{
for(int j = 0; j<b.length; j++)
{
if(a[i]==b[j])
{
System.out.println(b[j]);
}
}

//Function to find UNION


static void union(int a[],int b[])
{
int i = 0;
int j = 0;
System.out.println("The union of the two sets is: ");
while (i < a.length && j < b.length) {
if (a[i] < b[j]) {
System.out.println(a[i] + " ");
i++;
} else if (b[j] < a[i]) {
System.out.println(b[j] + " ");
j++;
} else {
System.out.println(a[i] + " ");
i++;
j++;
}
}
while (i < a.length) {
System.out.println(a[i] + " ");
i++;
}
while (j < b.length) {
System.out.println(b[j] + " ");
j++;
}
}

public static void main(String[] args)


{
int n=Integer.parseInt(JOptionPane.showInputDialog("Enter the size of Set A:"));
int m= Integer.parseInt(JOptionPane.showInputDialog("Enter the size of Set B:"));
int[] a=new int[n];
int[] b=new int[m];
int[] c=new int[n+m];
for(int i=0;i<a.length;i++)
{
a[i]=Integer.parseInt(JOptionPane.showInputDialog("Enter Element "+i+" of Set
A:"));
System.out.println("The Element "+i+" Of A is :"+a[i]+"");
}
for(int j=0;j<b.length;j++)
{
b[j]=Integer.parseInt(JOptionPane.showInputDialog("Enter Element "+j+" Of set
B:"));
System.out.println("The Element "+j+" Of B is :"+b[j]+"");
}

int menu;
do
{
menu=Integer.parseInt(JOptionPane.showInputDialog("Please Type:\n 1-
Intersection\n2-Union\n3-Exit"));
switch(menu)
{
case 1:{
intersection(a,b);
break;
}
case 2:{
union(a,b);
break;
}

case 3:{
System.out.println("EXIT");
break;
}
default:{
System.out.println("INVALID INPUT");
}

}while(menu!=3);

}
}

OutPut:
First the program will ask
to enter the size of set A
and set B(How many
elements are in set A and
B).
Second the Program will ask to
add The elements of Set A and
set B
After the two first steps, the
program will show a menu bar
which we can choose from an
option.
We enter 1 for the intersection
of the two sets.
We enter 2 for the union of the
two sets.
And 3 to exit the program.
(the Menu will reappear every
time we choose an option until
we choose 3(exit)).

You might also like