1 / 196

CS-612

CS-612. PC SOFTWARE APPLICATION SKILLS. BLOCK 1. Problem Solving Techniques. UNIT 1. Classical Problems and Puzzles. Crossing the Konigsberg Bridges.

lada
Télécharger la présentation

CS-612

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS-612 PC SOFTWARE APPLICATION SKILLS

  2. BLOCK 1. Problem Solving Techniques | | <document classification>

  3. UNIT 1. Classical Problems and Puzzles | | <document classification>

  4. Crossing the Konigsberg Bridges • The problem of the Konigsberg bridges is a case in point: at the centre of this town, which lies on the river Pregel, is the island of Kneiphof, connected to each bank of the river by two bridges. A fifth bridge runs to a neighbouring (smaller) island, which has also one bridge linking it to each bank. | | <document classification>

  5. Crossing the Konigsberg Bridges • In 1736 Leonhard Euler the great Swiss mathematician was asked:Is it possible for a person to return to the starting point after having crossed the seven bridges once, and only once? • Euler converted the problem to a graphic representation, in which each land mass becomes a vertex, and each bridge and edge between two vertices(Fig.2(a)). | | <document classification>

  6. Crossing the Konigsberg Bridges • In graph-theoretic terms, the problem reduces to the question: Can one trace the figure starting at one of the vertices in a continuous fashion, traverse each edge only once, and return to the starting vertex? Try this without lifting your pencil from the paper. • Euler proved that a closed trail of this kind - named an Eulerian circuit in his honour - does not exist for the graph of Fig. 2 (a). | | <document classification>

  7. Crossing the Konigsberg Bridges • He proved in fact: a graph G (which we may define as a composition of two sets: vertices and edges) contains a circuit if every vertex of G is of even degree. The degree of a vertex is the number of edges which meet at it. • For each vertex in the circuit there must be an edge by which the vertex is reached, and another by which it is exited.A loop (Fig. 2 (b) )contributes two, and not one, to the degree of a vertex. | | <document classification>

  8. Crossing the Konigsberg Bridges • Eulerian circuit in a graph forces all its vertices to have even degree: • Start at some vertex on the circuit, and follow the circuit from vertex to vertex, erasing each edge as you go along it. • In passing through a vertex, you erase one edge entering and one edge exiting, or else you erase a loop. In each case you reduce the degree of the vertex by two. • Eventually every edge gets erased, and all vertices are reduced to zero degree, So all vertices must have had even degree to begin with. • The graph of the Konigsberg bridges has vertices of odd degree, and cannot include an Eulerian circuit. | | <document classification>

  9. Cannibals and Missionaries • Consider now the well-known problem involving three cannibals and three edible missionaries, who are all initially on the left bank of a river, and wish to cross it. • The only boat available is one capable of carrying two persons; and the condition of safe crossing is that at no time can the cannibals outnumber the missionaries. • How do they cross the river, with no one getting eaten? | | <document classification>

  10. Cannibals and Missionaries | | <document classification>

  11. Cannibals and Missionaries | | <document classification>

  12. Cannibals and Missionaries | | <document classification>

  13. Cannibals and Missionaries | | <document classification>

  14. Decanting Problems • Suppose that you are given three jugs A,B AND C, with capacities 8,5 and 3 litres respectively, but none are calibrated. • Jug A is filled with 8 litres of wine. • By a series of pouring back and forth among the three jugs, divide the 8 litres into two equal parts:4 litres in jug A, and 4 litres in jug B. | | <document classification>

  15. Decanting Problems • We represent the vertices of our graph as "states" or ordered triples such as (a, b, c),where a, b and c represent the amounts of wine in the jugs A,B,C respectively. | | <document classification>

  16. Decanting Problems • Decanting problems are most directly solved using trilinear co-ordinates, in which three sets of parallel lines divide the plane into a tessellation of equilateral triangles. • In this system the co-ordinates (x, y, z) of' a point P are defined as the distances of the point from the sides of an (appropriately large) equilateral Triangle ABC, with side a and altitude h. | | <document classification>

  17. Decanting Problems • Since the area of any triangle is half the base times the altitude, • we see that: • Area(ABC) = Area(PBC) + Area(PCA) + Area(PAB) • OR 1/2 (ah) = 1/2 (ax) + 1/2 (ay) + 1/2 (az) • OR x + y + z = h • Thus trilinear co-ordinates can be useful when three variable quantities have a constant sum, and the application to pouring problems in immediate. | | <document classification>

  18. Decanting Problems (8,0,0) A M L (6,2,0) T U (6,0,2) I R (5,0,3) (4,4,0) Z (3,2,3) N P (3,5,0) S K J V W B C Q (0,0,8) (0,8,0) (0,5,3) (1,4,3) (1,5,2) | | <document classification>

  19. Decanting Problems (8,0,0) A M L (6,2,0) T U (6,0,2) I R (5,0,3) (4,4,0) Z (3,2,3) N P (3,5,0) S K J V W B C Q (0,0,8) (0,8,0) (0,5,3) (1,4,3) (1,5,2) | | <document classification>

  20. 1st solution (Not useful) P Q A S T U V W Z 2nd solution A R I J K L M N Z Decanting Problems | | <document classification>

  21. Decision Trees • When alternative choices can be made based on discrete answers - usually true or false to questions, and then further choices are made based on those answers, the graphical representation of the situation results in a special kind of a graph called a decision tree. • Root->first choice or decision • Branches->consequences of further choices • Leaves->the final solution • Decision trees are used to find solutions of puzzles | | <document classification>

  22. Decision Trees Consider a well known problem: • You are given twelve apparently identical coins. • One of which is counterfeit, weighing less than the eleven others • All of the other eleven being of same weight. • Given:an equal-arm balance • Determine: the counterfeit coin in no more than 3 weighing. Total=12 coins, Counterfeit coin=1 Therefore, Equal size coins=11 | | <document classification>

  23. (A-F) : (G-L) Lighter? Lighter? (G-I) : (J-L) (A-C) : (D-F) Lighter? Lighter? Lighter? Lighter? G : H A : B D : E J : K Lighter? Lighter? Lighter? Lighter? Lighter? Lighter? Lighter? Lighter? A G H C B I D E J K F L Decision Trees | | <document classification>

  24. UNIT 2. The Higher Arithmetic-I | | <document classification>

  25. Prime Numbers • An integer number is said to be prime if it cannot be expressed as the product of two (or more) factors each smaller than itself. • The first few primes are: • 2, 3, 5, 7, 11, 13, 17, 19,... • The distribution of primes seems to follow no law or pattern: indeed, though prime numbers have been the subject of study for thousands of years, it is in general impossible to predict the next prime after a given prime. | | <document classification>

  26. Prime Numbers • A composite number can be expressed as the product of primes in one and only one way, except for order of the factors. Thus: 48 = 2 x 24 = 2 x 2 x 12 = 2 x 2 x 2 x 6 = 2 x 2 x 2 x 2 x 3 • This statement, called the Fundamental Theorem of Arithmetic. • 1 differs from the other integers that it does not fall within the ambit of the Fundamental Theorem. It can be factored into a product of 1's in more than one way: • 1 = 1 x 1 = 1 x 1 x 1 = 1 x 1 x 1 x 1, etc. • Therefore it is conventional to regard it as composite. | | <document classification>

  27. Prime Numbers • Because the integers can be factored into a product of primes in a unique way, prime numbers can he regarded as the fundamental building blocks from which all positive numbers are constructed. | | <document classification>

  28. Gaps Between Primes • Earlier we remarked that the primes are distributed quite irregularly in the sequence of integers. • Consecutive primes may differ by 2 (such prime pairs are called twins, and examples are (17, 19), (179, 181), etc.); or there may be arbitrarily long runs of consecutive composite integers without a single intervening prime. | | <document classification>

  29. Gaps Between Primes • if a number is divided by 4, the remainder can only be 0, 1, 2 or 3. Numbers which leave remainders of 0 or 2 are even, and therefore composite (with the sole exception of 2, the only even prime); thus primes may be divided into two classes, of types 4n + 1 and 4n + 3. • Lemma 1: If two integers a and b are each of the form 4k + 1, their product is also of the same form. • Regardless of whether N is prime or composite, there is yet another prime of the form 4k + 3, and so on ad infinitum. | | <document classification>

  30. The Sieve of Eratosthenes • Suppose that an odd integer n is given which is to be tested for primeless. • In order to do this we must divide it by a succession of prime divisors. • Given n, what is the largest divisor that we need try, before concluding that n was prime? • The best way to answer the question is to experiment with some given n. Experimentation leads to insight, and insight may lead to proof. • In order to test a number for primeness it is sufficient to use only those prime divisors which yield a quotient greater than or equal to the divisor itself, i.e. divisors which are less than or equal to the square root of the given number . | | <document classification>

  31. The Sieve of Eratosthenes • Eratosthenes (273 - 192 BC, b. Cyrene) used this principle to list all primes less than or equal to a given positive integer n | | <document classification>

  32. UNIT 3. The Higher Arithmetic-II | | <document classification>

  33. Hungarian Problems • Prove that the expressions: • 3x + 7y and 9x + 4y are divisible by 17 for the same set of integral values of x and y. • Prove that the expressions 21n + 4 and 14n + 3 have no factors (other than 1) in common for any value of n. • Determine all positive integers n for which 2n + 1 is divisible by 3. • Prove that for any natural number n, the expression • A = 2903n - 803n - 464n + 261n is divisible by 1897. | | <document classification>

  34. Hungarian Problems • Let al., a2, a3, ..., an, be an arbitrary arrangement of the numbers 1, 2, 3, n. Prove that, if n is odd, the product • (al - 1) x (a2 -2) x (a3 -3) ... (an - n) is an even number. • Prove that for every integer n greater than 2 • (n!)2 > nn • An arithmetic progression is a sequence of equally spaced terms: • a, a + d, a + 2d, a + 3d , ..... where a is the first term of the progression, and d is the common difference. Prove that in an infinite arithmetic progression of natural numbers in which the common difference is not zero, not all the terms can be primes. | | <document classification>

  35. Hungarian Problems • Prove that the product of four consecutive natural numbers cannot be the square of an integer. • Let a, b, c and d be four integers. Prove that the product of the six differences: • b-a, c-a, d-a, d-c, d-b, c-b is divisible by 12. • For any integer n greater than 2, prove that the nth power of the length of the hypotenuse of a right triangle is greater than the sum of the nth powers of the lengths of the smaller sides. | | <document classification>

  36. Hungarian Problems • For any three consecutive integers, the cube of the largest cannot be the sum of the cubes of the other two. • Seventeen people correspond by mail with one another - each one with all the rest. In theft letters only three different topics are discussed. Each pair of correspondents deals with only one of these topics. Prove that there are at least three people who write to each other about the same topic. | | <document classification>

  37. An Archimedean Result • Archimedes, the first practical mathematician whose record we have, computed a creditable value for pi, and derived formulae for the area of a circle and the volume of a sphere; • But a less well-known result answered the question: what is the volume common to the orthogonal (i.e. at right angles) intersection of two cylinders of diameter d? • Though his original proof is lost, it is speculated that he might have reasoned as follows: • Suppose the axes of the cylinders to lie along the axes of X and Y, so that half the cylinders lie above the X-Y plane, and half below. | | <document classification>

  38. | | <document classification>

  39. The Theorem of Pythagoras Area(PQRS)-4 x Area(ABC) =Area(LQMN) + Area(JMKR) =AB2 + BC2 -------(1) Area(PQRS)-4 x Area(ABC) =Area(STUV) =AC2 -------(2) From (1) and (2) AC2 =AB2 + BC2 (The Theorem of Pythagoras) | | <document classification>

  40. Irrational Numbers • An irrational number is a number that cannot be expressed in me form p/q, where p and q are integers. • The square root of 2, by Pythagoras' Theorem the diagonal of a square of side one unit, is such a number. • Suppose that you had two pieces of string, one of length 1 unit, and the other of length 21/2 units, and the task is: • "Cut up these two strings into pieces of equal length, as small as you like, but they must be the same length for both strings." • That could not be accomplished ever, For 21/2 is incommensurate with 1. | | <document classification>

  41. The Division of a Plane by Straight Lines • What is the maximum number of regions Rn into which a plane can be divided by n infinite straight lines no two of which are parallel, and no three of which go through the same point? • When there are no lines, the plane consists of one region. • R0= 1 • One line divides the plane into two regions: • R1= 2 • Two lines divide the plane into four regions, and three into seven. Four lines divides the plane into eleven regions.We can now guess the formula: • Rn= Rn - 1+ n | | <document classification>

  42. The Division of a Plane by Straight Lines • Our experience with small values of n helped us to derive a "recurrence relation", which seems to be valid for the cases considered. • To find a general formula for it in terms of n alone: Rn= Rn-1+ n = Rn-2 + (n-1) + n = Rn-3+ (n-2) + (n-1) + n = R0+ 1 + 2 + ...... + (n-2) + (n-1) + n =1 +Sn, • Where Sn is the sum of the first n positive integers. | | <document classification>

  43. The Division of a Plane by Straight Lines • To evaluate Snwe'll adopt a method that Carl Friedrich Gauss discovered in 1786, when he was nine years old. • His teacher assigned the class the problem to find the sum of all the integers from 1 through 100. • Gauss wrote the correct answer (5050) within a few moments on his slate, placed it face downwards on his desk, and waited. • His teacher was appropriately astounded on seeing his tablet, blank but for the answer. Every other boy had attempted the solution by laboriously performing 99 separate additions but had it wrong. | | <document classification>

  44. The Division of a Plane by Straight Lines • Gauss solved the problem by observing that when the sum is arranged as below: • 1 + 2 + 3 + 4 + 5 +... + 96 + 97 + 98 + 99 + 100 and the first term paired with the last: • 1 + 100= 101 the second with the second from the last: • 2 + 99 = 101 the third with the third from the last: • 3 + 98 = 101 each pair adds to 101. There are fifty such pairs. The sum of numbers from 1 through 100 must therefore be 5050! | | <document classification>

  45. The Division of a Plane by Straight Lines Using Gauss' trick we can write: Sn = 1 + 2 + 3 + ..... + (n - 2) + (n - 1) + n Sn = n + (n - 1) + (n - 2) + ...... + 3 + 2 + 1 2Sn = (n + 1) + (n + 1) + (n + 1) + + (n + 1) = n (n + 1) Thus Sn = n(n + 1)/2, and Rn = 1 + n ( n + 1) / 2. | | <document classification>

  46. MINIMUM SPANNING CIRCLES • Jung's Theorem: Every finite set of points of span d has a spanning circle no greater than d 3 1/2 /3, a still better bound. Though smaller spanning circles are possible for certain finite sets of points, there are some which require the spanning circle to be at least this large. PQ=d, OP=d/2, PS=d, Maximally | | <document classification>

  47. UNIT 4. General Methods | | <document classification>

  48. Experimentation Experiment 1 : Consider the problem of finding the sum of the first n cubes: Sn = 13 + 23 + 33 + 43 + .... + n3 if n = 1, then S1 = 1; if n = 2, S2 = 9; if n = 3, S3 =36; and if n = 4, S4 = 100. Is the sum of the first n cubes always a perfect square ? We test for a few more values, and tabulate our results: S1 = 1 = 12 S2 = 9 = 32 S5 =225 = 152 S3 = 36 = 62 S6 = 441 = 212 S4 = 100 = 102 S7 = 784 = 282 There is a pattern here, certainly. | | <document classification>

  49. Experimentation Experiment 2: Euler proved a theorem : Every positive whole number is the sum of not more than four squares. This is really a remarkable theorem, because the gaps between the squares increase rather rapidly: 1, 4, 9, 16, 25, 36, 49... Yet no more than four are required to be summed to produce any number! Experiment: Write down the squares of the first ten integers. How many numbers can You make using four or fewer of these squares? Which is the smallest number that requires squares different from those on your list? | | <document classification>

  50. Experimentation Experiment 3: Goldbach's conjecture:Every even number after 4 can be written as the sum of two odd primes. Prepare a list of the first 100 primes, and now answer the following question: In how many different ways can even numbers be expressed as the sum of two primes from your list? For example: 16 = 3 + 13 = 5 + 11, yielding 2 partitions; 60 = 7 + 53 = 13 + 47 = 17 + 43 = 19 + 41 = 23 + 37 = 29 + 31 (6 partitions). Can you conjecture that as an even number N increases, the number of its possible partitions into primes also increases? Is there a pattern in the numbers of partitions, that is are there some N for which the number of partitions is larger dm for the neighbours of N? Do even factors of 15 have more partitions than their neighbours? | | <document classification>

More Related