.

.

.

.

.

.

.

.

WI 51 e length t r: d mt: tart with a simpl" problem Wh t 'f up 0 . b WIg not 0 vlQus. we can separate the square mto 25 smaller areas. it is easy to see that we will need 27. For nota~ion simplicity. At the same time we have 9 (3x3) possible combinations for the weights of coins in bag 1 and bag 2 (9 pigeons). c • I~ " -I 0 1 -2 1 4 -3 0 3 '0 U 0 1 -I ~ eland 2 Solu'io~: To guarantee that the glass encompasses at least 3 ants. In either sub-case. alyouhavetwb f" d you nee from each bag to find the ty f . Then how about 3 bags? We are going to have 33 = 27 possible combinations.' com . the sum ranges from -4 to 4. and we can not distinguish them. A coin can weigh 9 grams.a positive integer.:::3 people) met each other. So the answer is to take 1.. we only use 2 coins from bag 2. Now we can move on to .. Applying the generalized Pigeon Hole Principle we can show that at least one of the areas must have at least 3 ants.n~ equal weight. you and the pair (3 people) met each other. 2 . e rom ag 2 In order to determine the com will need three coins fr~m ~nsli~nng tha~ there are three possible types for bag I. The following table exactly shows that all possible combinations yield different sums: Sum t coin. An intuitive property of modulo operation IS H· 22 23 .area Into 5 x 5 smaller squares with side length of 1/5 each will do since a circle with radius of 1/7 can cover a square'? with side length 115. which is possible to cover all 9 combinations. and C3 represent the weights of coins from bag!. If the problem-1 2 bags Ho m~:Separate the square into 25 smaller areas' h A circle with radius r can cover a square ith "d' en at least one area has 3 ants in it. "H' S . then these people (..414. bag 1 -I -4 Ants on a square There are 51 ants on a square with side length of 1. we change the number/weight forat~re~ ~wo cOIn_S won't do. 0 ags 0 coins Instead of 5 how many coins do bers: 'Th en how about three bags? pea Comsmeltherb ago 'Wh' at IS the rmrumurn difference . Surely an indicator ranging from -13 to 13 will cover it and we will need 9 coins from bag 3. So we only need' to make sure that.7 Modular Arithmetic The modulo operation----<lenoted as x%y or x mod y-finds th~ remainder of divisio~ of number x by another number y.Brain Teasers A Practical Guide To Quantitative Finance Interviews If two people in this group met each other. Case 2: Suppose at least 3 people have not met you before. to determine which type of cams each bag contams using a single weighing. cOl.3. then these people (> 3 people) did not meet each other. 2. If no pair among these people met each other.. can you put your glass at a position on the square to guarantee that the glass encompasses at least 3 ants?'! N CO .. 0 and I (by removing the mean 10).. 2. the glass is large enough to Cover any of the 25 smaller areas. respectively.let's start with the simplest version of ag. then.. Simply separate the .coins from bag 4 and 81 coins from bag 5. For example. ~n~ 5. let's ypes to I. How many trues 0 you need to use the scale to d t ' hi 13 e ermine w Ich type of coin each bag contains? b . r an Ji » 1. 5%3 = 2. .2. If you have a glass with a radius of 117. The possible combinations are shown in the following table: Sum C2 -t -I C2=O C2 1 1 -8 1 10 -I -7 Counterfeit coins II There are 5 bags with ~00 c~ins in each bag. C2.. ... ' num In 12 11 ~ CO . c '0 U ee I~ " -I 0 0 -12 1 -II -2 7 -I 0 -9 0 9 0 1 -5 -13 -10 -I -6 3 12 -4 5 -3 2 II 4 ~ 1 6 8 13 C 1. 4. . 3. C2 represent the weights of coins from bag 1 and 2 respectively. 9. If two people in this group did not meet each other. e °dny need to take one com to weigh it. in either sub-case..' 27 and 81 corns ~rom bags 1. the conclusion holds. the final sum for I coin from bag 1 and 2 coins from bag 2 ranges from -3 to 3 (7 pigeon holes). Solution: If the answer for 5 ba s is Following this logic. types of bag 1 and bag 2? C '. so at least two pigeons need to share one hole). If we use 3 coins from bag 2.. au have a digital scale (the kind that tells the exact weight). Again. So at least two combinations will yield the same final sum (9)7. the conclusion holds. and 3 res p ectiveiy . you and the pair (3 people) did not meet each other. w many cams a we need to tak f b ' . but we do not know what type of coins of ti g d . If all pairs among these people knew each other. 10 grams or II ~r::s~~n~~~~a~ contain. For simpicility. we only consider the case where! Is.

Prisoner problem One hundre... They are given the night to come up WIith a strategy among themselves to save as many . isn't it? What if . or else t~ey are ImmedIatel~ executed. They are all told hat each wII~be given a red or blue hat to wear.(lO'-I)~a-9x. . and (x+2)%3 are all different.+a"_I+'''+QI+ao)' which is divisible We by 9 well. 104 and 105._110"-1+"'+QII0 +Qo' have 0. blue. Let's use the following . if the number of red hats is odd among th h . ave 3 colors. e IS set free Immediately. Since (x+0)%3. his Own hat color combin~ng :~m~gue~sed correctly. h he i '. then the integer is divisible by 9.. er weanng a red hat will . then the Q is divisible by 9 as let b=a-(Q. so from the remainder that the first prisoner gives (for the 99 prisoners including i). + QIIO + Qo' Basically we + state that if a" +Q. otherwise the integer is not divisible by 9. . The key lies in the first prisoner wh be red if the number of red hats he a ca? see everyone. Let's consider a prisoner i among 99 prisoners (excluding the first prisoner).(10"-I)+a"_. But how do we prove it? I Let's express the original integer as a == a" 10" + Q. he can determine his own score (color).. "'. a = b + 9x must be divisible by 9 as well. the rest of 99 prisoners and calculates s%3.. then (XI-X2)%y=O. He has 1/3 chance of living. For example. If the sum is divisible by 9. come up with a rule to decide whether it is divisible by 9 and prove it.. One color has mt: at a number is odd sim I er 0 counts. k = 1.. and (x+y-I)%y From this property we can also show that are all different numbers. he announces red. The hat colors are assigned randomly an nee the hats are placed on top of eac~ priso~er's head they cannot communicate with one other in any form."-:-H::-' -------tnt: The first prisoner can h odd number of c see t e number of red and blu h IS H' t: Th ounts and the other has even numb feats of all other 99 prisoners. since all (10k -1).d prisoners are given the chance to be set free tomorrow. sees IS odd. pnsoners as POSSI What IS the b t t ble h can they guarantee to's ?14 es s rategy t ey can adopt and how many prisoners ave. so you may want to consider (Similarly you can also show that a = (-I)" a" + (-Ir- l Q. x%y. ner can see everyone else's at but not hIS own. The prisoners will be called out' n random order and t~ePnsonerhcalledout will guess the color of his hat. Add up all the digits of the integer.Brain Teasers A Practical Guide To Quantitative Finance Interviews that if XI%Y=X2%Y. Th~ two-color case is easy. (x+I)%3. The proof is straightforward: 1 For any a=a"IO"+Q.) 24 25 . Otherwise he declares his hat to be blue. The total score of those 98 prisoners is 103. Solution: At least 99 prisoners can be saved. (x+l)%Y. otherwise he is executed. Because both band 9x are divisible by 9. The difference IS sconng system: red===Oreen«] g d bl _chance of survival. Solution: The a~swer is still that at least 99" ._I . a similar strategy can be extended to any number of colors. Here we h . a pnsoner guesses correctly the color of his at. e ot er 98 prisoners (excludi th fi 1 see even number of red hats III red hat..else's hat._I+···+al +ao =9x (x is a integer). . if prisoner l sees that there are 32 red. blue._IIO"-I . 2. I. green. but all the rest of the prisoners can determine his own score (color) from the remainder. He declares his hat to He will have a 1/2 chance f h . Everyone else is able to deduce among 99 prisoners (excludi e h edge whether the number of red hats is odd (excluding the first and hims:~ F e irst) and the color of the other 98 prisoners the other 99 prisoners A prison' or example. If the first prisoner announces that the remainder is 2 (green). Theoretically. If the remainder is 0. 29 green and 37 blue in those 98 prisoners (excluding the first and himself).(10"-'-I)+···+a. He can calculate the total score (x) of all other 98 prisoners. an ue-2. Each prisoner eclares the color of h hi s at so t at everyone else can hear it If . + (-IYal + ao = lIx + is the necessary and sufficient condition for a to be divisible by 11. x%3 instead p y means x%2 = 1. and guarantee to save?IS y can adopt and how many prisoners can they b~a..·· '. mg e irst and himself) and deduce that he is wearing a Solution: Hopefully you still remember the rules from your high school math class. then prisoner i knows his own color is green (1) since onlyI04%3~2 among 103. that.n are divisible by 9.. if the remainder is I. Surely that requires all prisoners to have exceptional memory and calculation capability. white? What is the best strategy the there are 3 possible hat colors: red. Division by 9 Given an arbitrary integer.. the first prisoner now only has 113 pnsoners wl~1be saved. Each . The first prisoner counts the total score for .

3z'+ 2). (To see this. at least one pair's difference must be a multiple or 3. 2.3y '+ I.3 chameleon color combination transitions from (0. especially discrete mathematics. As a result.3) is equivalent to combination (0. Coin split problem You split 1000 coins into two piles and count the numb~r of coins in each pile. for every integer n.3(y + 1). AIPI Phroachh A different. and P(n) together imply (0. as shown in Figure 2. Here we discuss two of them. = y+l. you need to realize that if combination (m+I. Then you split both piles further.) Prove that you always get the same answer no matter how the piles are divided.n. For chameleons of two different colors to have the same number their module f'" b 13 3' 0 .0.3 y.3y'+ 1. ate c ameleons to become th I ' : e same co or. 2 and 4 for three colors.Brain Teasers A Practical Guide To Quantitative Finance Interviews Chameleon colors A remote island has three types of chameleons with the following population: 13 red chameleons. the real difficulty lies not in the induction step.3z + I) = (3x'.I. 26 27 .6)? The answer is NO.2.2). If there are x coins in pile one and y coins in pile two. or any other smallest number n for the predicate to be true.8 Math Induction Induction is one of the most powerful and commonly-used proof techniques in mathematics. we WI ave three possible scenarios: In most cases. There are several approaches to proving this conclusion. combination (m. P(2). 3z'+ 2). Essentially. Approach 1.4) be converted to a combination (O.4) Actually combination (1. 3y + 1.p) can be converted to the same color as well. w en two chameleons of different colors meet. we can simplify the problem to 0. but to formulate the problem as an induction problem and come up with the appropriate predicateP(n).5)~ Figure 2.ion process.3: (3x + 2. they would change their color to the third color.) Can a combination (0. Is it ever possible for all chameleons to become the same color? Why or why not?16 Solution: It is not possible for all chameleons to become the same color. In other words. you multiple x by y to get -'Y. The simplified version of the problem can often help you identify P(n). . one y meets one z (3x. e eon.2.2.4). Since the numbers 13. I.3z '+ 2). For example. 2) but will never reach (0. repeat the same counting and multiplicat. 0 see IS. and more fundamental approach is to realize that in order for 2. • (I.3). 15 green chameleons and 17 blue chameleons. y to Yl + Y1Y2' The same process is repeated until you only have piles of I stone each. What is the final sum? (The final 1 's are not included in the and jc. the relative change of any pair of colors after two chameleons meet is either 0 or 3. • Prove the base case P(I). onex meets one y So the pattern is preserved and we will never get two colors to have the same module of 3. in a strong you prove that P(l).} must e the same as well. Alternatively. Just imagme the stage before a final stage. at certain intermediate stage two colors have the same number T must thi . you split x to XI and e.p+l) can be converted to the same color.3z + 2) => (3(x -I) + 2. 3(z + I) + I) = (3x'.1. 2.3z + I) = (3x '. then the sum is XY+X X I 2 sum. and 17=3z+2 cham I h 'II b .. we cannot make two colors have the same number. if a green chameleon meets a red chameleon.n+l.2. the chameleons cannot become the same color. onex meets one z { (3(x -1) + 2. and add the new multiplication results to the original. The general steps for proof by induction are the following: • State that the proof uses induction and define an appropriate predicate P(n). ' must h th bi . Many problems that involve integers can be solved using induction.x). 30 ~(O. 16 H' mt: consider the numbers in module of3. "'. 15 and 17 are "large" numbers. We start with 15:::: 3x. which can only be converted to another (0. • Prove that P(n) implies P(n+l) induction P(n+I). For example.0. 1. Each time two chameleons with different colors meet.3y. they both change their color to blue. argument. It as e com inatton (1.3 y'+ I. In order for all the chameleons to become one color.

:. For m > 1 and n = 1. Applying e cone usron to n -1000 . Clearly the only split IS + a~ t~e fi~al sum IS 1. There are N gas cans randomly placed on different locations of the track and the total sum of the gas in these cans is enough for your car to run exactly one circle. u z l. Since there is nothing special for the case m == 6 and n = 8. We can prove it using strong induction. columns < n. If N coins are split into x coins j(N)~x(N-x)+ j(x) + j(N-x) = N(N -I) We for we and cases where rows < m. which takes men -1) breaks.:ry = 2 and ~~is2~~~t ~~I:I:Illfurther gi~e an extra mu1tip~ication result 1.smaller rectangles. But is the total number of breaks always mn -I for other sequences of breaks? Of course it is. but you can put your car at any location on the track and you can pick up the gas cans along the way to fill in your gas tank.3 should give you ' enoug h hi hint to realize the pattern is 2 28 18 = 1. the total number of breaks is (m-1)+m(n-l)=mn-1. Although induction is the standard approach used to solve this problem. we will have mn pieces. columns < n. ln the end.t h ld f . we have a single piece. Similarly. then the Here we use the 1111 total number of breaks is I+(mxnl-I)+(mx(n-nl)-1)==mn-1. 'Of either case we can apply x (n-x ) + j( x)+ fen-x) and yields the same final Solution: Let m be the number of the rows of the chocolate bar and n be the number of columns. the base case has n = 2. the number of breaks is 47. Each time. Again N ~x coins. If you ar~n t surefihow to approach th~ problem. and then break each row into n small pieces. Assume that your car has no gas in the gas tank initially. the first split is 2 + I and we have .. columns S n and rows::. A ssume t he clai n = 2 . sum . ease cases n=234 . If the first break is along a row and it is broken into two smaller pieces m x nl and m x (n . we have .so the final sum is 3.Brain Teasers A Practical Guide To Quantitative Finance Interviews SoIUfiO~:Le~ n ~e the number of the coins and fen) be the final sum. there is actually a simpler solution if you've noticed an important fact: the number of pieces always increases by 1 with each break since it always breaks one piece into two. Ca~ yo~ alw~~s choose a starting position on the track so that your car can complete the entire Circle? Hint: Start with N " J(2)~I.nl).at II hi' IS the total n urnb er 0 f b reaks needed in order rna squares? Race track Suppose that you are on a one-way circular race track. it never hurts to begin with the simplest cases ~nIt7 todmd a pattern. Soindeectitholdsforn~N as well and j(n)_n(n-l) . the number of breaks is m -1. For example ~~. - Chocolate bar problem A chocolate bar has 6 rows and 8 I ' IVI co Indt idual squares by making a numb umn s (48 sma 1I l x l squares). O ~~e.m.x n-x + f(x)+ fen-x). if we break the chocolate into m rows first. ~he(hmt that when n coms are split into x and n-x total sun: will b coins. Let's begin with the base case where m = 1 and n::::: 1. b~eaks.we need to prove that . If we breaks it into n columns first and then break each column into m small pieces. break one rectangle into ar IOta a 6x3 one and a 6x5 one Wh' ~ irst step you can break the 6x8 chocolate to break the coco ate bar Into 48 s . JO)-J(2)'2 and J(4)-J(])n(n-I) !(n)-".2 and solve the problem using induction. It is unlikely that a so~ut1onwill Jump to our mind since the number n = 1000 is a large nwnber. we should find a general solution for all m and n. the 3 IF' e n -xn-x)+j(x)+j(n-x). results for rows:$ m. N -I . . You break it into ~wo.the number of breaks is n -I. n = 1 and m=l. 29 .. When n == 3. the final sum is n(n -1) 2 17 So how do we prove it? The answer should b I have proved the claim for th b e c ear to you: by strong induction. the total number of breaks is also mn -1. independent of intermediate splits. similarly for m = 1 and n > 1. ' e c aim IS true " COins. th I' 2 IS true for any n 2: 2 .. the total number of breaks is 1+(m1xn-I)+((m-ml)xn-l)=mn-1. We have shown the number of breaks is mn -I for base cases m :?-I. To prove it for a general mxn case. So 1 the total number of breaks is always mn -1 in order to break the chocolate bar into mx n small pieces.. In the beginning.we have j(n) ~ 1000x999/2. So the number of breaks must be mn-1. 4 coins can be split into 2+2 or + 6. if it is broken into two pieces (m-11l x nand ~x(N -x)+ N(~ -1) + (N -x)(N -x-I) 2 2 )xn. which takes m -1 breaks. let's assume the statement is true for Claim: For n coins. For the case m = 6 and n = 8.1+2+"'+(n_l)=o . apply the equation fen) _ () lOS or n = N coms as well. The number of breaks needed is clearly O. So for any m and n. ~or this problem.

n. 2. .+I to one gas can at the . I O' ' and pick up gas can I I hoe Cl~Ce. So the statement also holds for N == n + 1. you measure the amount of gas in your gas tank before you add the gas from the can to your gas tank. With more gas . In other word 1+1 X. where x is an 2 2 2 2 2 J2. Hence we can always choose a starting position on the track to complete the entire circle for any N. If m and n have any factor. But that both m and n are even contradicts the earlier statement that m and n have no common factors. again start with the simplest ca~es (N -1. we can actually "combine" . you show that if a proposition were false.2) and c.I th e pro bl em . s. There is also an alternative approach to this problem that provides a solution to the starting point. Li s Xi' It can reach x.4A. then some logical contradiction or absurdity would follow. If XI ~ YI ' we can start at gas can 1.4B we h Yl+Y2+"'+Y ==1l':orN ' ave XI+X2+"'+x . the amount of gas in can I and can 2 expressed as the distance the car can travel.. Let's use a figure to visualize the approach. (It is called Yi B d an segments between gas cans The argument for N == 2 a Iso gives us the h' . show that if the statement holds for N _ tnt for the induction step. Then m2 = 4x2 and we also have n = 2x . So in we will have a pair of m and n that have no common factors. so Xl + X2 = I~ The corresponding segments are YI and Y2' so YI + Y2 == 1.) Since m/ n = we have m = 2n • So m must be an even number and m must be an even number as well.=1 and 11+1 11 ==n+l. As shown . Irrational number X. otherwise it is irrational.9 Proof by Contradiction In a proof by contradiction or indirect proof. and h POSItion of x. IS s~art a~where the gas can is. The problem is still simple. for j ~ irreducible fraction. which has enough gas to reach gas can 2 and get more gas from gas can 2 to finish the wh I . If J2 is not an irrational it can be expressed as a ratio of two integers m and n. For N == 2. A Figure 2.4 Gas can locations on the cycle Xi Can you prove that J2 is an irrational number? A rational number is a number that can be expressed as a ratio of two integers. Now we want to N = n + I. Solution: number. we can remove it by dividing both m and n by the common factor. are XI and x2 respectively. The gas can position corresponding to the lowest measurement should be your starting position if the car has no gas initially. with ' t e gas can i+I). we must have x > y or I I x2 > Y2 ( Xl < YI an d X2 < Y2 cannot both be true). lsi:::. w enever the car reache' . An executioner will put a hat on each prisoner's head. (Forl=n+l It goes to .. Whenever you reach a gas can (including at the initial position). n + I. Without loss of generality. After you finish the circle. the proposition must be true. Thus. that I . Every prisoner can 31 30 . Rainbow hats Seven prisoners are given the chance to be set free tomorrow. So J2 must be an irrational number. Let's express m as Zx. since m is even.onslder usmg an induction approach. J US! . Each hat can be one of the seven colors of the rainbow and the hat colors are assigned completely at the executioner's discretion. Since XI + x2 == I and YI + Y2 = I. integer. As shown in Figure 2. therwise.Brain Teasers A Practical Guide To Quantitative Finance Interviews Solution: ~f you get stuck. common the end. let s assume that the circle has circumference of 1. as to ~ow to ~olve ~he problem. For N . That means h e must exist at least one i. Let's imagine that you have another car with enough gas to finish the circle. 1 == Instead). then the same statement also holds for III tgure 2. You put that car at the position of a randomly chosen gas can and drive the car for a full circle. which the statement holds. I'd recommend that you again draw a figure and give this argument some careful thoughts if you don't find the reasoning obvious. But such binati an amount of gas x·+x (and eliminate com matron reduce th N I 1+1 S e == n + I problem to N = n.r. read through your measurement records and find the lowest measurement. we will just start at gas can 2 a ong t e way to fimsh the whole circle. which means n must be even as well.) x. This is a classical example of proof by contradiction. So there muer avr 11+ has X Y . I -. F' . tnviat. (It may take some thinking to fully understand this argument.

5.1 Limits and Derivatives Basics of derivatives Let's begin with some basic definitions and equations used in lim. but not his own. you can find these materials III any calculus textbook.2. 1. + e. 5 or 6 as well.du at least one of g must equal t i 0 to be set free. many guesses can 7 prisoners make? ' H' t L' . 3. (since ( s. for i = 0. 2.5. they are guaranteed The quotient rule ~(: )+~-u:)jv'. prisoners won't know what others' guesses are. Since most of the tested calculus and linear algebra. the prisoners can hear others' guesses.6 as well-should give a guess gi so that the sum of gi and the rest of 6 prisoners' hat color codes will give a remainder of i when divided by 7.. In the previous prisoner problem.0 then 3. Then ( %7 must be 0.4. Chapter 3 Calculus and Linear Algebra Calculus and linear algebra lay the foundation for many advanced math topics used in quantitative finance. rule: dx t. we can guarantee at least one of gi == Xi (go + LX .3. and 6. The generalized power rule: dy" 11-1 dy -6 r 'Vn:t:dx = ny dx a a L>. knowledge is easy to grasp. Then each prisoner i-let's label them as 0.4. If you are not familiar WIth any of the concepts. ) %7 must be among 0.1. where g. " . 3. complex problems-Ill quantitative interviews. then rex) = dx = t':'o LIx = t~ f(x+LIx)I(x) LIx exist. . spend some time reviewing your college textbooks! Needless to say. If your memory of calculus or lmear algebra IS a little rusty. "x" (tx. 5.6. Then each prisoner writes down his guess of his own hat color. And unless necessary. )%7" i and e. (t x. usmg this strategy.~itho~t covering the proof. S a result. To solve the problem. are both between 0 and 6). it does so .x. If at least one prisoner correctly guesses the color of his hat.2 3 4 50r6 How I. dy . For example. 6 . They are given the night to come up with a strategy.2. or else they are immediately executed. (~)=u'7v' dy dy du and u = u(x) . The key to the aha moment is given by the hint. If We can easily prove this conclusion by contradiction. and X.w h'rch i c Iear I' rmpossi ibt e. then (~X)%7" LJ .3. details or even caveats of these concepts. k )%7 == O.its ~d derivatives. Some useful equations: 32 .2. 1. please refer to your favorite calculus/linear algebra books for details. "X. is a unique number between a and 6. This chapter focuses only o~ so~e of the core concepts of calculus/linear algebra that are frequently occurrmg m quantitative interviews. 1. 4. prisoner a's guess should make This way. then dx = du dx The chain rule: If y = f(u(x)) 19 tnt: et s assign the 7 colors of rainbow with cod ) e 0-6 and Xi be the color code of prisoner i. In this problem. Is there a strategy that they can guarantee that they will be set free?l9 Solution: This problem is often perceived to be more difficult than the prisoner problem in the modular arithmetic section. ':ol The product dx dx If u == u(x) and v = v(x) and their respective derivatives ( uv-u )'_ 'v+uv' 0..1. it does require an aha moment. the marginal benefit far outweighs the time'y0u spend br~shll~g up your knowledge on key subjects. So one prisoner's declaration gives all the necessary information other prisoners need. )%7" i Derivative: Let y = f(x). otherwise they will be executed.Brain Teasers see the hat colors of the other six prisoners. for all i = 0. Although the notations may be different. Neither is it my intention to do so. So IS y d(uv) dv -=u-+v-. But if s. So be prepared to answer some calculus or linear algeb~a problems-many of them may be incorporated into more. They cannot communicate with others in any form. Once you realize that if we code the colors to 0-6. Xi' A . it is extremely difficult to condense any calculus/linear algebra books into one chapter. 4. they all will be set free immediately. Lly .

+-. the chain rule and th d your knowledge of basic derivative formulase pro uct rule. Taking the derivative of lex). Y .du J"(x)..r x x ln r l-eln x from e to fl.. Let u=lny=ln(lnx'''')-1 h we ave du dx .0 X HO j'(c) > 0. d I du u' -Inu=--=dx udx u Second Derivative test: d" "du -e =edx d . If J'(e) = 0 and f"(e) > 0.+··· So n=O n. 34 35 . if • X IS Derivative ['( ) . can you tell me which number is larger. Since d(lny)/ cit. logs on both side f functIOns with the format _ . 2 Hint: Again consider taking natural logs on both sides. is an increasing function at c. we have J (x):::: 1 ::::: x: x2 ' c To derive d(ln(lnx)) . if e d cos x. then J(x) j'(e) = 0 and ["(e) < 0. J(x) x v has global maximum when e for all x>O. . What is the derivative of y = In Xln . .i-dy _In(lnx) Inx d dx +-==>2_Y(1 y x xlnx dx --:. 2. ~~ suppose that lim [(a) =0 x--. Applying the cham rule and the product rule ' Let's take natural logs of elf and ffe..nxx In (I nx ) . In fact. = d(lny) dx ~_: = d~X) xln(lnx)+lnxx d(ln(lnx)) dx In(ln x) x +--. If J(c) is either a local maximum value or a local minimum value of [(x).h Y Wit respect to x.Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews In(ab)=lna+lnb 1im~=1 lim(l+x)"=I+!<x . . On the left side we have >lle.. At point x:::: c. on the 1r right side we have e ln x. g '(a) " O. specifically.U and 'H' tnt: To calculate the derivative 0 . v» > O.x has a local maximum at c. [(x) is a decreasing lim(lnxlx')=O H' for any r>O Local maximum or minimum: suppose that J(x) is differentiable at c and is defined on an open interval containing c. If elf ell" >1[e ee s-x ln e c.o and limg(a)=O X--.+~. if j'(c) < 0. then [(x) has a local minimum at e. 3. ln x'?" Alternative approach: If you are familiar with the Taylor's series.'" 1/ yx dy/ dx. xx-x ' mSectlOn3. dx ' we agam use the chain rule by setting v = In x : d{1n(lnx))_d(lnv)dv I I dx -=-x-=~ dv dx v x which is less than 0 when x> e (In x > I).4. 1/ . .f(x) . is dx continuous near e. the Illstantaneous rate of ch ( .. I. dx cosx = -sinx. . Let rule x = ff I e -1.youcanapplyTaylor'ssenestoe : e ::::LJ!=I+.e If > st e . ~ tan x e sec. which we will discuss • 1 3 . It IS common to take natural e. xlnx In x Is it true? That depends on whether J(x)::::: lnx is an increasing or decreasing function x . ?1 Without calculating the numerical results.Q or that lim[(a)-+±oo X--. L'Hospilal's Further Suppose that functions [(x) and g(x) are differentiable at x -+ a and that . dx smx dx a -=(a dx d" " Ina). Suppose the secondary derivative of J(x).1'1e > 1l I e ¢:> e tt t e > J[ ee. t en e h . --. tangent line to the curve y = [(x) and ange velocity) of . xx"". e J[e ?2 Solution: tr or Solution: This is a good problem to test . So ->-e Ine Ina 1r an d e" e e »w.e x ln a c> Ine e > lnff. then j'(c) = O. Maximum and minimum essentially the slope of the . Jr In e . [(x) foranyk function at c. e x > 1+ x. s and then take the derivativ . In a > In b :::::> a > b since In x IS a monotonously increasing function. xln x n(InX)+I)=~(ln(lnx)+I).

to lim Xl In x since it's :. Let u ==In x I' e' f'(x) d( ')1 e dx eX -x~2x ==}!!!'d(2x)ldx ==~~2==oo e . f(x) IIm--== x_"'g(x) Im-==lim--r x-. by parts..a g(x)· that the original Inx limit as IIm----:? ecomes obvious rule: lim x-2 == x-. What is the integral ofln(x)? Solution: This is an example of integration d(uv) = vdu + udv ~ (x x IIx)dx+ Inxdx. Solution: ~~~ Xl t~'" Integration by substitution: is a typical example rule lim eX ==00 and lim. then we call If f(x) = F'(x) example. . . we can rewrite . we only need to remember two of them: li~x2Inx=Iimlnx=li t_O x-+O' X -2 x-->~ d(lnx)ldx .r e umev X-a) The result still has the property that -"-". i J/i(aj f(u)du lim--== x~a g(x) f(x) e' x~'" g'(x) lim __ f'( x ) .In x ==-co.. format of lim f(x) d Ir b It x-.O· L'Hospital's co and !!~o. let's begin with some basic definitions ..1 rf (x) = 1F'(x)dx r = [F(x)]: = F(b)- F(a) ~d:c(~s:::ec:cx~+~t:::an~x) x + tan x) .so <-->'" X~ a) A. dsecx ==d(J/cosx) == sinx dx F(x) an dx cos" X e sec r tan x.- x~"'2x Integration by parts: JUdv ==uv. du~g'(x)dx g '(x)dx ~ f(h == Applying L'Hcspital's rule." x: ff(g(x)).HO'. lim-== x~"'X2 in definite integrals: r f(g(x))' 1. Solution: Clearly this problem is directly related to differentiation/integration trigonometric functions. Ilnxdx==xlnx- Idx==xlnx-x+c.I' . L'Hospital' not in the an I d s ru e oes not appear to be applicable H owever. we have 00. . What is the integral of sec(x) from x ==0 to x = lr /6? of basic cos x. d( 2) I dx ==lim X Ilx x-->O' -21x' ==lim - .Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews limg(a) Ho -> too."'x2 . then lim f(x) = lim f'(x) HO g(x) . lim f(x) - I we can app y the L' Hospital's rule again: .x' x~O. The rest can be derived using the product rule or the quotient rule.JVdu . ncuon F(x) with deri .<-+:og'(x) e . we have At first look. For dx 3. and what is the limit of of L'Hospital's Xl In x as SInce x ----t O+? constant.<->a g '(x) form. _ 2 =0 ~sinx dx e ~cosx:::: -sinx. where C IS any as x ----t u). envatrve f(x). wherecisanyconstant. _ ==lirn!. = sec x( sec dx 37 36 . . L'Hospital's rule converts the limit from F(a) ~ Yo => F(x) ~ Yo + r f(t)dl an indeterminate form to a determinate The generalized power rule in reverse: What is the limit of eX / x 2 f u du ==--+c k U k" k+ 1 (k '* I). onllderivative of f(x) . li and v ==x .~ x-4O·xSo we can now apply B. co an d I'Img(x)==hm2x:::=00..2 Integration Basics of integration Again.g'(x)dx= Substitution ff(u)du with u~g(x). If we can find a fu . and equations used in integration. Although there are derivative functions for all trigonometric functions.

If you cut the i . So v= c c. Taking advantage of symmetry. So z va ues. where C2 is the rate of cross-sectional area increase per hour (since the snow falls at a constant integration. At I pm. For these '. we get c --dt=cJn(l+T)-clnT~cJn T+t (I+T) ~2.Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews Since the (secx+tanx) d In I secx+ tan x dx ~ term occurs in the derivative. V ume IS = A(z)dz where A(z) is the cross-sectional area of the solid cut b I .f3) Applications of integration A.11l (')3 = .OJ!:::::> V-I 6/3 r 3 = 1613. The from the sphere IS Inscribed r i e.1 Interaction of two cylinders B. we also have A(t) = c2 (t + T). the eireIe "" "" in ICU Acirde = ~ A'<'1 a/'t" Since it's true for all e Isquare from the intersection as well. the cut will e a square WIth side-length ~( 2)' (2)2 calculate the total 1 r . centers also intersect.10 secx ~ In(sec(Jr /6) + lan(Jr /6» . The snow began to fall some time before noon at a constant Solution: This problem is an a licati fi . If t is defined as the time after noon.z . = 16/3r3 ~ 16/3" An alternative app h " ". h d' .mtersec! at right angles and their e vo ume a the intersection? Figure 3. roac reqUIres even b tt 3 . When did the snow begin to fall? Solution: Let's denote noon as time 0 and assume snow began to fall T hours before noon. c where c~-' Taking the = c2(t+T) t+T c. Let's imagine a sphere that lt sphere should have a radius of A IS mscribed inside the intersection as well. ICU t part IS to correctly [annulate the integration. we also have tan x) e 1_ secx(secx+ (sec x + Ian x) sec r ~ fsecx=lnlsecx+tanx!+c an d f''r/6 . The plow removed snow at a constant volume per minute. applied problems. The city of Cambridge sent out a snow plow at noon to clear Massachusetts Avenue from MIT to Harvard. 'Ole'sec/IOJ! - i~ l1 1 (I c l'--dt=cJn(2+T)-clnT~cJn T+t From these two equations. b' ntersecnon by a horizontal plane. 38 39 . The general IntegratIOn function to calculate 3D vol . 3 miles. IS lllscnbed inside both cylinders . The speed at which the plow moves is inversely related to the vertical crosssectional area of the snow: v =cjl A(t).T)' ~+- =>T'-T+1~0=>T=(J5-1)/2. Figure 3. What is ::c wilt ra flUS 1.ploere . th I each cut perp en di Iar to the z-aXIS. " f' rate. it had moved 2 miles and at 2 pm. expression for eros s-sec tirona Iarea A as a functton of z. '" The key here is to find the right y ~ pane perpendicular to the z-axis at coordinate z. ~ ~r D Imagination.In(sec(O) + tan/O) = In(. we have rate). we can vo ume as 2x 1[{2r)2 _{2Z)2}tz =8x[r2z_z3 /3]. c1 is a constant representing the volume of snow that the plow can remove every hour and A(t) is the cross-sectional area of the snow. the most di~ I on o. we have V:.1 gives us a clue. -T (2+T) =3 -T (2 T)' . integration to volume calculation. where v is the speed of the plow.!L V 4 2" 4 Intersect. Suppose that two cylinders h .

. ". n. what is E[ X I X > O]? Solution: Since X . . tests analytical skills.4 Important Calculus Methods Taylor's series One-dimensional Taylor's series expands function f(x) > ) and that each of variables If all these functions have continuous first-order partial derivatives. this question..~. X . y == r sin e..rsinB)rdrdB_ II If X is a standard normal random variable. integration knowledge and algebra knowledge.O tu x [e-XlI2dx=:J%.$r e- t12 2 . In Chapter 4.e-""dx=2f Jz.y)=> af (xo'Yo) = lim f(xo + ill:.J21r:::::> ax ik-.y)dxdy n ~ jff(rcosB.. aXt + Ow &:2 at. at derivatives at a point x xo : f(x)=f(xo)+ 40 I'(xo)(x-xo)+ 1"( o ) 21 X (x-xo)'+---+ f"'(x 0 ) 1 (x-xo)"+--n. Tthe integration in a continuous polar region R is converted to l.Yo).x Xl' x2.E[X I X > =: ~ ~ r -beudu j== (". the probability density function of x is f(x) and we have E[X 2 Calculate [e-xlI2Jx. Here we just use one example to show its application: "" fff(x. constant.2" = IX > 0] ~ f xf(x)dx ~ f x . i for as the sum of a series using the ax". e- . we have e by letting u = -I / 2x2• Replace If you've forgotten the pdf of the standard normal distribution or if you are specifically asked to prove rx Jke~112X\lx =: determined by x -.wehave ~2" (e~x212dx=:. Second order partial derivatives: a'f ax' = ~(af). aXl afi aX2 + ./2. e~J'2/2dy == [( ~f re-"12rdrdB f e-"I'd(-r'/2) = - e~(Xl+yl)/2dxdy == rr e ~(rlcos2B+r2sin20)/2rdrde r dB 3.r Solution: Hopefully you happen to remember that the probability density function (pdf) x1 of the standard normal distribution is f(x) == ~ e. we have II '" dx .e-"l2dx=l=> fe-"l2dx~J%- obvious that we can use Integration by substitution .N(O. a' f = ax (0') ~ a af a af a/a) The general chain rule' Supp th . By definition. ~ =: - .f(xo./Expected value using integration Integration is used extensively to calculate the unconditional or conditional expected value of continuous random variables. 41 . it is Because d(-1/2x )=-x and JeUdy=eu +c.. Ow ax'!!. we will demonstrate its value in probability and statistics.l/2m-=I. although fairly straightforward. I s.x2.···. ~-[e-"I'IrBr Since [e~x2/2dx= [e~y212dy.. e ~lIhlWith e" an d x dx wrth -du.. ose at w== f(xt. xm is a function of the variables 11' f .Yo) = J. Changing Cartesian integrals into polar integrals: The variables in two-dimension plane can be mapped into polar coordinates: x =: r cos e. i:<.N(O.. + at. X is 0 and x =: problem: .[euJ. 2 3. 1).".J2" you will need to use polar integrals to solve the U =: -OCJ OJ= l/fh' [ e-x212 dx [".\ Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews Overall. ax ax ax0' . where c is an arbitrary [f(x)dx~ [Jz. then 8w :::: v m each i. OCJ ~ =: - AJr(O-I) • =: h' where r-r [_J_e. ".3 Partial Derivatives and Multiple Integrals Partial derivative: w= f(x. I)..

(x): J(x)=I.Os ... prove (I + x)" 2':1+ nx for x > -I .1 . . 42 43 ..3 Hence... \Ix > ~I when n == the same (1+x)"'2:I+(k+l)x. et's look h ' e . iJr/2 equation becomes eiJrl2 =cos(1l/2)+isin(1l/2)==i.. we have J(x) = J(xo) + I'(xo)(x . 2! n! Tavlor's seri~s are often used to represent functions in power series terms.+1 and e z z.+ J''''(O) x" + . k. J(x) = J(O) +J.-==l+-+-+-+ /I"on! I! 2! Combining these three series. + 0 (x-xo)" and aremamder R.. ('''')'. cosx . . The first and secondary derivatives of f(x) 0 1 are I'(x) = n(1 + x)"-' and I"(x) = n(n -1)(1 + X)"-2..(x)+R. The base case: show (I + x)" 2':1+ nx. 3! x) . since (1+x)22':1+2x+x2 The induction statement 2':1+2x.BS II 21 '31+-+1-+ . v x > -1 when n == which can be easily proven 2.~ n! For some x between x and ( ) _ J''''''(x) o '''X_ R ______ (n+1)! The Taylor's series can also be expressed For Xo == we have (1 + x)" == for v n ~ 2. Prove (l + .(O)x + J"(O) x' +. cosB=l __ + 2! 4T-6T+'" . It is clear that 1 + nx is the first two terms in the Taylor's (l series of I(x) senes. n(n-I)(1+x)"-'x22:0 If Taylor's series does not jump to your mind..(~. Wehave at t e proof Applying Taylor's series to eiU = I iIJ (i1J)' + +-+ I! 2! IJ' IJ' (i1J)3 ('IJ)' 1 every integer n 2':2 . .. = . ... the condition that n is an integer may give you the hint that you can try the induction method. step: show that if (l + x)" 2': 1+nx. cos When f) == .' e '" I '" e ..LetMbethemaximumof ") !R" (x)l :$ ~ n(n -1)(1 + x)"-' x2 if x<O and x 2':x 2':0 if x o Il . 2'. ' stn x e L. we get constraint I x-xo 'I... = I + nx+ t/ -I IJ''''''(x) for all i between xo' and x..e nes. sin x and cosx a. This step IS holds for n :::k + I : 31+-. it is apparent that ei8 == 8 + i sin B. >O. For example aylor s senes for three common transcendental functions. (n-l»O. /.we have »c-D.B' +1--1_+ .xo)' = J(O) + ('(O)x + I"(x) x' 2! . 4. 8 __ i~ }1 .. Vx>-l..Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews If Xo =0.·=I+i·O 0 .(1+x)"-2 and J(x)=(I+x)">I+nx.(x) = J(xo) + I'(xo)(x _ x ) + J"(xo) ( )' J'''' (x ) • 0 21 x-xc + . 7T+'" x 6 x 7 Solution: Let f(x) == + x)" .cos8 and sin 8. Hence. So we can consider solving this problem using Taylor's 2! +41-61+'" h as t e Sum of the nth-degree Taylor polynomial T.. When 8 == /2. We can rephrase the problem as: for Solution: The solution to this probl can be proven using Taylor's seri eLmuses Euler's formula.Xo I (n+ I)! . ~(-I)"X2/1+1 "00 (2n+ I)' =x--+ 3! 5! 4 X __ x' B. the cos ~ II So Ini==ln(e JrI2 . e". with X e "(1)/12/1 L"o0 (2n)! x =1-':"'- 2 o::: O.. 4! 5! straightforward as well.xo) + I"(x) (x . the equation st becomes eiJr == II + i sin II == 1. Applying Taylor's series. e" ==cos19+isinB which . In(ii) == Hni == i(i1!/2) == /2:::::} ii ==e-J[ )==ill/2. .. OS sm8=19 __8 +_ 87 3! 5! -71+''':::}isin8=i 3 If 0 IJ' 3 4 . 2 where x:$x:5:0 Since x>-l M x I x .'1x>-1.x 2':O. xo=Oare ' 2 3 x~l XX X e =L. 3! 5! 7' 3 'CI ear Iy t hey satlS'J equatIOn 'fi. . .-+ ..r)" 2':l+nx for all x > -1 and for all integers n~2.

2' oes converge.. we set a. O function f(x)=-/..-37 2x o =6 36-37 2x6 =6. B. = a.).. converge.083 = 37. =. f(x.+b.)/2)<0. At each step. I I· J() 0 Xo =.00289. It starts with two initial values aoand bo such that J(ao) < 0 and J(bo) > O. there must be an x between Go and bo that makes f(x) J(a.083 and x = 6 + y = 6. then y = 0. Compared with Newton's method." Convergence of Newton's meth d ..close to the root.'" Bisection method is an intuitive root-finding algorithm.J5)/2. = (a" + b")/2. ewton s method.. =. especially when the starting point e correct so 1 unon For Newt' th d . is far away from th 0 ~snot guaranteed.+b. X/HI-XI bisection method converges linearly.) If you do not remember Newton's meth d . =(a.. If we ignore the / term. IS an iterative process for solving the equation [(x) = O..Js sufficiently. J( (a" +b")/ 2) > 0.+b.you can directly apply Taylor's 2 • method but slower than Newton's method. If I( (a" +bJ/2) = 0. . ~1+(k+l)x '1x>-1 Alternatively. --. O? Assume f(x) So the statement holds for all integers n 2:: 2 when x > _I. Could you explain some root-finding algorithms to solve f(x) a differentiable function. bl a pomt .. e onginal problem is e . Applying N ' qurva ent to so vmg x = . It IS 0 en ~ ..083. the convergence rate is quadratic.-X )2 .) t 0 1 I() (Lif so ve x = I XI. Since I(x) is differentiable. .y2+l2y-l=0. ft necessary that the initi I . the iteration stops and x='(G" +bJ/2. .X2. .I(x") f'(x. . 5 =x Il . 1 XI and applies the iterative step ) in Newton's method with a Solution: Let J(x)=x2-37 =X . we can use algebra since it is obvious that the solution should be slightly higher than 6.. Solve x2 =.--.. Its convergence rate is (I + (6. ::. f O. IS Newton's method Newton'~ met.also known as the N~wton-Raphson method or the Newton-Fourier method. =b" and a. f(x) must be I erentIa e around the root When it d .''---.. which makes it valuable if f '(x) is difficult to calculate. convergence is not guaranteed if initial values are not close to the root. We have (6+y)2=37=.). It begins with an initial value Xo and applies the iterative step x Il+] Solution: Besides Newton's method._I J(x ).. _ on s me 0 to converge. Lagrange multipliers The method of Lagrange multipliers is a conunon technique used to find local maximums/minimums ofa multivariate function with one or more constraints. Similar to Newton's method.hod.. th Secant method starts with two initial values xO' x .)I2. which is very close to 37.)/2). hiIchmeans ( x"+1 -x)f <0<1 w h (X. But once you find an Go/ bo pair. with f'(x) =. A. which means it is slower than . 44 45 ..083. which makes it faste~than the_bisection -- J(37)~ J(36) + 1'(36)(37-36) = 6+ 1/12 = 6. convergence is guaranteed. we check the sign of If The we set b. the bisection method and the secant method are two alternative methods for root-finding. 6 5 Newton's method is also used in optimization-including multi-dimensional optimization problems-to find local minimums or maximums. or its absolute value is within allowable error.. it does not x" -X"_l require the calculation of derivative f'(x. 6 is a natural initial guess. and b".lx_112. which is small. It replaces the f'(x " " linear approximation x. we have x =x _ J(xo) _ 1 0 J'(x ) -xoo 2 "J( - x" )-J( xn_1 ) x" -X.---k~t Newton's method.[(x" I)..Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews (I+x)'" =(I+x)'(I+x) ~(I+kx)(I+x)=I+(k+l)x+kx2. 37 to the third digit. If J«a. series for --- .083. 0 < 1.were xf is the solution to !(x)=O..

YP 3. for a plane D= Idl . = !(x. _ reveals the necessa g . we have i!f i!f iJx+A. I"erentlal Equations First-order linear differential equations + P(x)y di .r'. B • S 0 Ive or dimary diffrerentia I equation y . where A.···.". XII ) WIith gra d'lent or V!(x)=(Z" %1' "'..Vg. .(x)+ Lagrange multipliers.(x)=O..) = 0. the problem can be expressed as min D J A. h(y) What is the distance from the origin to the plane 2x + 3Y + 4z = 12 ? Solution: The distance (D) from th " I' .Y I = x+y . Let Z = x + y . which IOnsto constrain d I' 46 e non mear optimization problems. Integrating both sides. 47 . .' . then the original differential equation is converted to d(z -x) = x-(z -x) c> dz -I = 2x -I ""zdz = 2xdx => fzdz = f2xdx+ dx z dx z =::::} C (x+ y)2 = Z2 = 2x2 +c =::::} i + 2xy-x2 =c In thi .Vg.X2. ~).t. +AkVg.xJ =0.Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews Let I(x" x" "'.."'.7 2x+3y+4z-12=O In general.5 Ordinary D'u . e ongm to a pane IS the nurumum distance between the ongm and points on the plane.x -. The standard approach to solving a first-order differential equation is to identify a suitable function l(x). ~s ~ectlOn.. dy Solution: Let g(x) = -6x and h(y) = y. gk(XI'X2. iJy+/loay =2y+3A.~ -6xdx. "'.(x)+A.X. such that f(x)(y'+P(x)y)=f(x)y'+f(x)P(x)y The method of Lagran e '. Mathematically. But we can use a change of variable to turn it into a separable differential equation. Solve ordinary differential equation y'+ 6xy = 0.Ja2 +b2 +c2 • Solution: Unlike the last example. ty conditIons for the solun ~arush-Kuhn_ Tucker (KKT) conditions.J29 with equation ax + by + CZ = d. dx can express the original equation as h(y) . called an integrating factor. we cover four tical seen In mterviews.z) = x y 2 + / + Z2 s.y.fu"=2x+21=0 iJj the equation: fdY y = f -6xdx <> In y = _3x2 + c :::::> y = e~3xl+c. x. we have c = 0 and Y = e-J. ~ultlphers is a special case of . A separable differential equation has the form dy = g(x)h(y). we have the is thatV/(x)+A. y(O) =1 Integrate both sides of where c is a constant. the distance to the origin is . 6 7 Hint: Introduce variable z = X+ y.z)=2x+3y+4z-12=O Applying the Lagrange multipliers. '. this equation is not separable in its current form..XII) = a are called the dy = g(x)dx.Ak solution f dy ~ fg(x)dx. g(x. Plugging in the initial condition y(O) = 1.) be a function of n variables x = (x I' x 2" " vector ".=0 a: + /loa:= 2x + 41 = 0 ~aj 1 iJj if "" D=~(1!)' +(")' + (-"-)'_~ 29 29 29 -. . IfferentJal equation patterns that are commonly A first-order differential linear equation has the fonn : = Q(x). we The necessary condition for maximizing minimizing !(x) subject to a set of k constraints gl(XI.y. . we have . . g2(XI'X2 Separable differential equations Since it is separable.

where x> O. cos fix +C.. If which means I(x) is a 8 and f2 are real and 'i = r2 = z-. linear separable differential equation with general solution lex) = ef"lX)dt. d railC 'c I -b+.O dx dx ' It is easy to show that IS equation a d . dx particular yg(x) IS + b dy +c = d(x) has no closed-form solution. x and Solution: In this specific case. must satisfy dI(x) T 3. should either commit the fonnula to memory or be able to derive it using (r + bI2a)' (b' . If rl and = I(x)?(x).+c=O.differential equation with the form for a--?+b-..J3/2). dx dx d' d then y=y.t:. You 48 49 . then the general solution is Y = cle'x + c~) f2 The ! ina ' e mtegratmg factor. »e (III. we get c = I and y = In x+ I x Homogeneous linear equations A homogenous linear '.Iyany . ' has roots given by qua .}b'-4uc lonnua r=o = B The Constant c is not needed' In th' IS . a mear equation.. for y: I(x)y = fI(x)Q(x)dx fI(x)Q(x)dx I(x) 2. a non homogeneous dx I' mear = I. where c\ and c2 are . I =e"'=x I x . ' d'y dy the general solution of the homogeneous equatIOn a""""d7"+b-. d' e~atlOn a(x)--?+b(x) dy +c(x).. sin fix) . If f1 fl and r: are real and 'i :. differential equation is therefore y fJ = ..(x). 9 A quadratic ..CIYI x +C2Y2(X).Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews = (1(x)y)'.'J. . then any y( ) _ () arbitrary constants is a I t' x .J3 /2/ (a = -112. mstea of functions of x. case Since itjust I sea es both sides of the equation by a factor.. we have a = b = c = 1 and b' .".4ac)/4a' . Solve ordinary different equation y'+ y = --\-. cos fix + c2 sin fix) = e-lI2x (c cos( . xy .(x)+ y..!+c=d(x). d'y dy general solution of the nonhomogeneous equatron a dx2 -r b dx +c = d(x). I(x)..!. and c (a*O) are constants' d ' linear equation has cia de. and the general solution to the Q( x ) .Jj / 2x))..f(l/)dx x Plugging in y(l) I =nx+c::::::>y= In x + c . then the general solution is Y = e'" (c. Then we have (1(x)y)' = I(x)Q(x) =:> y and we can integrate both sides to solve I.J3/2x) i + c2 sin(.I S 0 I (x)=e -7' 1"<". Nonhomogeneous I Un Iike a homogenous 2 linear equations ' . 'a . f2. then the general solution is y = cle'lX + c2e'2X .4ac = -3 < 0. so we have complex roots r = -11 2 ±. the homogeuow se lorm sOlutIOns: Let r: and r be th 1 2 e roots of the characteristic equation ar2 + br + cu~ 0 9 v . x = e'" (c. But if we can find a dx "Yr(x) solution a second-ordej. x x Solution: This is a typical example of What is the solution of ordinary differential equation y"+ Y '+ Y = O? first-order linear equations with P(x) and we have I(x)Q(x)=-. I(x)(y'+ ?(x)y) = (cry)' = I(x)Q(x) = II x Taking integration on both sides .d'y hnear equation a dx2 + b dy + C = 0. homogeneous li . are complex numbers a ± ifi. if d I 2 are rmear I'y independent solutions to t e h . equation ar"+hr+c=O . y(1) = 1. where IS . so U Ion to the homo li Wh b geneous mear equation as well en a. =. It is easy to verify that the general solutions indeed satisfy the homogeneous solutions by taking the first and secondary derivatives of the general solutions.

~tatlshcs.. If you still remember all you need is that some trigonometry. etc.(x) = e-u" (c. y and z as vectors.8. in the special case when dCi) is a simple polynomial. l. The correlation coefficient of two random variables can be viewed as the cosine of the angle between them in Euclidean space (p = cos e). y = y.2. sin( J312x)).96' = 0. . In this case.6 0.Calculus and Linear Algebra A Practical Guide To Quantitative Finance Interviews Alth~ugh it may be difficult to identify a particular solution YI'(x) in general.Yi = xTy 1. pp e~ quantitative finance because of its role in It is I . then we have and There are 3 random variables x. IS. L etYI'(x)=mx+n. the particular !'olynomial of the same degree.ical y 12:. sin(J312x)) 3. '\Ij . Then angle B between R" vectors x and y has the property that cos o = II x ___ __ xillY II" x and y I Y y = e-'''' (c.8.file t at Covers many topics In this section we methods. x IS ' - n-- . (a~-1I2 fJ- ' an d b' . What is the maximum and minimum correlation between Y and z? Solution: We can consider random variables x.8' . you can solve the problem using Pythagoras's Theorem: . 1 . cos( J312x) + c.(x)+ y. cos( J312x) + c. which is the case shown in Figure 3. 0. the angle between them needs to be the smallest. It can represent the coordinates of uc I ean space. product: the inner product (or dot product) of two R" vectors x and What is the solution ofODEsy"+ y'+ y = 1 and y"+ y'+ Y = x? Euclidean norm: IIXII~~tx" ~.JI' -0. optimization Monte C I . Ilx-yll~J(x-y)'(x-y) Solution: In these ODEs. . Lm~a~ algeb~a is extensively used in a Ii '. Not surprisingly. cos( J312x)+ c..6' = 0.__ 0.96 --. di a so a comprehensive mathematical fi ld ha igna processing.. lSCUSS several topics that have .4ac = -.8x 1. solution is often a Inner product/dot y is defined as L X. we want the maximum angle betweeny and z. What is a particular solution for y "+ y'+ Y = I? CI I _ y"+ y'+ Y = I is .(x) + Y.) < 0 so we have "/2) an d th e general solution IS ' . -. sin( J312x)) y = + 1. the minimum angle is 0 (when vector y and z are in the same direction) and the correlation is 1. Figure 3.(sin 8)' = 0..y = 0.28 Vectors ~n '" 1. So the particular solution is x-I e as well.JXTX.0. The correlation between x and y is 0. we again have a complex solutions r~-1/2±J312i = b ~ c -1 . For the minimum correlation. Let e be the angle between x and y.8 UJx __ 0.(column) vector is a one-dimensional a POint In the R" (n-dimensional) E I'd rray. .8 and the correlation between x and z is 0.28 Otherwise. ear y y -I SO the solution to are orthogonal if xl'y = O.2 = I xh => h ~ 0.6 Linear Algebra + (x-I).ar 0 sImulation si I . y and z. Y = Y. " cos(28) = (cos 8)' . then we have cos e = PX.(x) = e-u" (c. stgm tcant applications in statis~ics and nume. h ". Similarly the angle between x and z is For Y and z to have the maximum correlation.6 -"'" Z cos2B ~ .2 Minimum correlation and maximum angle between vectors y and z 50 5I . To find a particular solution for y"+y'+ Y '" +Y+Y= a +m+(mx+n)=x:::>m=l the solution to y"+y'+' y= x.