8.3 Quadratic Functions In this section we shall look at the connection between quadratic functions and symmetric matrices. Definition 1. A quadratic function z = f(x, y) of two variables x and y is one of the form z = f(x, y) = ax2 + 2bxy + cy2 + dx + ey + f (1) where a, b, c, d, e and f are fixed numbers. A quadratic form (or homogeneous quadratic function) is a quadratic function where only the x2, xy and y2 terms are present, i.e. one of the form z = f(x, y) = ax2 + 2bxy + cy2 (2) Example 1. The following are quadratic functions. z = x2 + 4y2 z = x2 - 4y2 z = 5x2 + 20y2 z = 17x2 - 12xy + 8y2 z = 17x2 - 12xy + 8y2 + 2x - 6y + 3 The first four are quadratic forms. A quadratic form can be written in vector form using a symmetric matrix. Proposition 1. (3) a b x ax2 + 2bxy + cy2 = (x, y) b c y = uTQu (4) a b x x ax2 + 2bxy + cy2 + dx + ey + f = (x, y) b c y + (d, e) y + f = uTQu + pu + f x a b where u = y , Q = b c and p = (d, e). Proof. The first part follows from the fact that z = ax2 + 2bxy + cy2 = (ax2 + bxy) + (bxy + cy2) = x(ax + by) + y(bx + cy) ax + by a b x = (x, y) bx + cy = (x, y) b c y = uTQu 8.3 - 1 The second part follows easily from the first. // Example 2. 17x2 – 12xy + 8y2 = (17x2 - 6xy) + (- 6xy + 8y2) = x(17x - 6by) + y(- 6x + 8y) 17x - 6y 17 - 6 x = (x, y) - 6x + 8y = (x, y) - 6 8 y = uTQu Problem 1. Write 6x2 – 4xy + 3y2 in the form (3). Answer: Q = - 2 6 -2 3 . Definition 2. The graph of a function z = f(x, y) is the set of all points (x, y, z) = (x, y, f(x, y)) in space where the z coordinate is obtained by applying the function to the x and y coordinates. A level curve of z = f(x, y) is the graph of the equation f(x, y) = k for some fixed number k. The contour map of z = f(x, y) is the set of all level curves. The graph will be a surface in three dimensions while each level curve is a curve in the xy-plane. A graph has an infinite number of non-intersecting level curves, one for each number k. The contour map consists of all these level curves taken together and it divides up the plane into these non-intersecting curves. Often one can get a good picture of the graph from the contour map. Many questions involving the function can be visualized by means of the graph and/or contour map. In this section we see how to make the contour map and graph of quadratic functions. We begin with quadratic functions of the form (5) x2 y2 z = p 2 + q2 x2 y2 where p and q are fixed numbers. In this case the level curves have the form p2 + q2 = k. If k < 0 there are no x and y satisfying the equation since the left side is positive and the right side is negative, so there is no level curve for negative values of k. If k = 0 the only pair of values of x and y satisfying this equation is (x, y) = (0, 0), so the level curve is just a single point, i.e. the origin. If k > 0 then we divide by k and rewrite the level curves as ( x2 k p)2 + ( y2 k q)2 = 1 or x2 a2 y2 + b2 = 1 with a = k p and b = k q. So the level curve is an ellipse extending from – k p to k p on the x axis and – k q to k q on the y axis. So the level curves are concentric ellipses x2 y2 which get larger as k increases. The resulting surface z = p2 + q2 is bowl shaped opening upward with its low point at the origin. It is called an elliptic paraboloid with its 8.3 - 2 vertex at the origin. The curves obtained by fixing y and letting x vary are parabolas as are the curves obtained by fixing x and letting y vary. Example 3. Consider the function z = x2 + 4y2. Draw the level curves for z = 4 and z = 8 and the graph of the function. x2 y2 The level curve x2 + 4y2 = 4 for z = 4 is the ellipse 22 + 12 = 1 extending from – 2 to 2 on the x axis and - 1 to 1 on the y axis. The level curve x2 + 4y2 = 8 for z = 8 is the ellipse x2 (2 2)2 + ( y2 2 )2 2 1 = 1 extending from – 2 2 to 2 2 on 4 2 2 the x axis and - 2 to 2 on the y axis. These are shown at the right along with the graph of z = x2 + 4y2. 4 1 2 The graph of a quadratic functions of the form x y z = - p2 + q2 2 (6) 2 is obtained by reflecting the graph of (5) across the z axis. It is an elliptic paraboloid openting down with its vertex at the origin. Now consider quadratic functions of the form x2 (7) y2 z = p 2 - q2 x2 y2 where p and q are fixed numbers. In this case the level curves have the form p2 + q2 = k. If k > 0 then when we divide by k the level curves have the form ( x2 k p)2 - ( y2 k q)2 = 1 x2 a2 or y2 - b2 = 1 with a = k p and b = k q. So the level curve is a hyperbola with vertices at – k p and kp b b on the x axis and asymptotes y = a x and y = - a x. So the level curves are hyperbolas b which get larger as k increases. If k = 0 then the level curves are the straight lines y = a x b and y = - a x. If k < 0 then when we divide by k the level curves have the form ( y2 - k q)2 + ( x2 - k p)2 = 1 or 8.3 - 3 y2 b2 x2 - a2 = 1 with a = - k p and b = - k q. So the level curve is a hyperbola with vertices at – k q and kq b b on the y axis and asymptotes y = a x and y = - a x. Again these level curves are hyperbolas which get larger as k decreases. x2 y2 The resulting surface z = p2 - q2 is saddle shaped surface called an hyperbolic paraboloid. It is said to open up along the x axis and open down along the y axis. The curves obtained by fixing y and letting x vary are parabolas as are the curves obtained by fixing x and letting y vary. Example 4. Consider the function z = x2 - 4y2. Draw the level curves for z = 4, z = 8 and z = - 4 and the graph of the function. 2 The level curve x2 - 4y2 = 4 for z = 4 is the hyperbola x2 y2 22 12 asymptotes y = x/2 and y = - x/2. The level curve x2 - 4y2 = 8 for z = 8 is the hyperbola x (2 1 = 1 with vertices at – 2 and 2 on the x axis and 2 2)2 - y 2 ( 2)2 4 = 1 with vertices – 2 2 to 2 2 on the 2 2 4 1 2 x axis and same asymptotes. The level curve y2 x2 x2 - 4y2 = - 4 for z = - 4 is the hyperbola 12 - 22 = 1 with vertices at – 2 and 2 on the y axis and same asymptotes. These are shown at the right along with the graph of z = x2 - 4y2. The graph of quadratic functions of the form (8) y2 x2 z = q 2 - p2 is similar to the graph of (7) only it opens up along the y axis and opens down along the x axis. We can summarize the above discussion by means of the following proposition. Proposition 2. Let z = ax2 + cy2. If a and c are both positive the graph is an elliptic parabolid opening up with its vertex at the origin. If a and c are both negative the graph is an elliptic parabolid opening down with its vertex at the origin. If a is positive and c is negative the graph is a hyperbolic parabolid that opens up along the x axis and opens down along the y axis. If c is positive and a is negative the graph is a hyperbolic parabolid that opens up along the y axis and opens down along the x axis. For general quadratic forms we have the following proposition. 8.3 - 4 Proposition 3. Let (9) a b x z = ax2 + 2bxy + cy2 = (x, y) b c y = uTQu x a b where u = y , Q = b c . Let 1 and 2 be the eigenvalues and v1 and v2 be the eigenvectors of Q. If we choose a new coordinate system for the xy plane with r axis through v1 and s axis through v2 then in this new coordinate system the equation (9) becomes z = 1r2 + 2s2. In particular, (1) The level curve ax2 + 2bxy + cy2 = k becomes the level curve 1r2 + 2s2 = k in the rs coordinate system. (2) If 1 and 2 are both positive the graph of (9) is an elliptic parabolid opening up with its vertex at the origin. If 1 and 2 are both negative the graph is an elliptic parabolid opening down with its vertex at the origin. If 1 is positive and 2 is negative the graph is a hyperbolic parabolid that opens up along the r axis and opens down along the s axis. If 2 is positive and 1 is negative the graph is a hyperbolic parabolid that opens up along the s axis and opens down along the r axis. Proof. Suppose we have normalized the eigenvectors as discussed in the previous section. Then Q = TDT-1 where T is the matrix whose columns are v1 and v2 and 0 D = 01 . We substitute this into z = uTQu to get z = uTTDT-1u = (TTu)TDT-1u. As 2 discussed in the previous section T is orthogonal so T-1 = TT. So z = (T-1u)TDT-1u. We can express a vector u in the plane as a linear combination of the eigenvectors v1 and v2, i.e. u = rv1 + sv2 where r and s are the coordinates of u with respect to this new r r coordinate system. Algebraically we have u = T s . So s = T-1u. So r T r z = s D s = 1r2 + 2s2. // 17 - 6 x Example 5. Consider the quadratic form z = 17x2 - 12xy + 8y2 = (x, y) - 6 8 y = uTQu. (a) Sketch the level curve 17x2 - 12xy + 8y2 = 20. (b) What kind of surface is the graph of z = 17x2 - 12xy + 8y2. (c) Sketch the graph of z = 17x2 - 12xy + 8y2. By example 3 in section 6.1 the eigenvalues of Q are 1 = 5 and 2 = 20 and the 1 -2 eigenvectors are v1 = 2 and v2 = 1 . Let the r and s axes be the lines through v1 and v2. The level curve 17x2 - 12xy + 8y2 = 20 becomes 5r2 + 20s2 = 20 in the rs coordinate 8.3 - 5 system. This is r2 + 4s2 = 4. It is an ellipse and its is below. The graph of z = 17x2 - 12xy + 8y2 is an elliptic paraboloic opening up and its graph is also below. 2 1 2 1 1 2 1 2 6 -2 x Problem 2. Consider the quadratic form z = 6x2 – 4xy + 3y2 = (x, y) - 2 3 y = uTQu. (a) Find a new coordinate system for the xy plane such that in this new coordinate system r the graph of the function z = 6x2 – 4xy + 3y2 has the form z = Ar2 + Bs2 where s are x the coordinates of y relative to this new coordinate system. Specify this new coordinate system by giving vectors along the new coordinate axes. Also, give A and B and the angle which the r axis makes with respect to the x axis. (b) Sketch the level curve 6x2 – 4xy + 3y2 = 98 showing relevant lengths. What kind of curve is it. (c) Sketch the graph of z = 6x2 – 4xy + 3y2. What kind of surface is it. 1 -2 Answers: The r axis is through v1 = 2 and the s axis is through v2 = 1 . In this new coordinate system the function z = 6x2 – 4xy + 3y2 becomes z = 2r2 + 7s2. The angle between the r axis and x axis is tan-1(2) 1.11 radians 63.4. The level curve 6x2 – 4xy + 3y2 = 98 is 2r2 + 7s2 = 98 in the rs coordinate system. It is an ellipse whose axis goes from – 7 to 7 on the r axis and - 14 to 14 on the s axis. The graph of z = 6x2 – 4xy + 3y2 is a elliptic paraboloid. 5 3 x Example 6. Consider the quadratic form z = 5x2 + 6xy - 3y2 = (x, y) 3 - 3 y = uTQu. (a) Sketch the level curve 5x2 + 6xy - 3y2 = 24. (b) What kind of surface is the graph of z = 5x2 + 6xy - 3y2. (c) Sketch the graph of z = 5x2 + 6xy - 3y2. First, find the eigenvalues and eigenvectors of Q. 8.3 - 6 5- 3 0 = det( Q - I ) = 3 - 3 - = (5 - )(- 3 - ) – 9 = 2 - 2 - 24 = ( - 6)( + 4) x So the eigenvalues are 1 = 6 and 2 = - 4. An eigenvector v = y for 1 = 6 satisfies 0 = (A - 6I)v = - 1 3 x 0 3 -9 y So - x + 3y = 0 3x - 9y = 0 3 The solution to both equations is x = 3y, so v1 = 1 is an eigenvector for 1 = 6. Since -3 the eigenvectors are orthogonal an eigenvector for 2 = -4 is v2 = 1 . Let the r and s axes be the lines through v1 and v2. The level curve 5x2 + 6xy - 3y2 = 24 becomes r2 6r2 - 4s2 = 24 in the rs coordinate system. This is 22 - ( s2 6)2 = 1. It is a hyperbola opening up the r axis with its vertices at – 2 and 2 on the r axis and asymptotes s = 6r/2 and s = - 6r/2. Its graph is below. The graph of z = 5x2 + 6xy - 3y2 is an hyperbolic paraboloic opening up along the r axis and opening down along the s axis and its graph is also below. 6 4 2 6 4 2 2 4 6 2 4 Finally, we consider general quadratic functions of the form (1). They can be reduced to quadratic forms of the form (2) by creating a new coordinate system parallel x to the orignal but with the origin shifted to a point u0 = y00 . 6 8.3 - 7 Proposition 4. Let (10) a b x x z = ax2 + 2bxy + cy2 + dx + ey + f = (x, y) b c y + (d, e) y + f = uTQu + pu + f x a b x 1 where u = y , Q = b c . Assume Q is invertible and y00 = - 2 Q-1pT. If we choose a x new coordinate system for the xy plane with origin y00 and r and s axes parallel to the x x and y axes then the equation (9) becomes z = vTQv + (f + pq + qTQq) where q = y00 and v = u – q. Proof. One has u = v + q. Substitute this into z = uTQu + pu + f. We get z = (v + q)TQ(v + q) + p(v + q) + f = vTQv + vTQq + qTQv + qTQq + pv + pq + f vTQq is a number so vTQq = (vTQq)T = qTQTv = qTQv since Q is symmetric. So z = vTQv + (2qTQ + p)v + (f + pq + qTQq) 1 Since q = - 2 Q-1pT it follows that 2Qq = - pT or - p = 2qTQT = 2qTQ since Q is symmetric. So z = vTQv + (f + pq + qTQq). // Example 7. Consider the quadratic form (11) z = 17x2 - 12xy + 8y2 - 10x - 20y + 15 17 - 6 x x = (x, y) - 6 8 y + (- 10, - 20) y + 15 = uTQu + pu + f (a) Sketch the level curve 17x2 - 12xy + 8y2 - 10x - 20y + 15 = 10. (b) What kind of surface is the graph of z = 17x2 - 12xy + 8y2 - 10x - 20y + 15. (c) Sketch the graph of z = 17x2 - 12xy + 8y2 - 10x - 20y + 15. -1 1 1 17 - 6 - 10 1 8 6 1 1 20 1 One has q = - 2 Q-1pT = - 2 - 6 8 - 20 = 20 6 17 2 = 20 42 = 2 and 1 17 - 6 1 5 f + pq + qTQq = 15 + (- 10, - 20) 2 + (1, 2) - 6 8 2 = 15 – 50 + (1, 2) 10 = x 1 15 – 50 + 25 = - 10. The rs coordinate system the has origin at y = 2 and axes parallel to the x and y axes. In this coordinate system z = 17r2 – 12rs + 8s2 - 10 and the level curve z = 10 becomes 17r2 – 12rs + 8s2 = 20. So we take the level curve 8.3 - 8 17x2 - 12xy + 8y2 = 20 that we made in Example 5 and move it to the right one unit and 1 up two units. So the level curve is an ellipse with center at 2 and it is shown below. The graph z = 17x2 - 12xy + 8y2 - 10x - 20y + 15 is an elliptic paraboloid. To make it we take the graph of z = that we made in Example 5 and move it one unit in the x direction, 2 units in the y direction and – 10 units in the z direction. It is also shown below. 4 3 2 1 1 1 2 3 1 8.3 - 9