Q
stringlengths
4
3.96k
A
stringlengths
1
3k
Result
stringclasses
4 values
Evaluate \( {\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \), where:\n\n(a) \( C : x = t,\;y = {2t},\;0 \leq t \leq 1 \)\n\n(b) \( C : x = t,\;y = 2{t}^{2},\;0 \leq t \leq 1 \)
(a) Since \( {x}^{\prime }\left( t\right) = 1 \) and \( {y}^{\prime }\left( t\right) = 2 \), then\n\n\[{\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} = {\int }_{0}^{1}\left( {\left( {x{\left( t\right) }^{2} + y{\left( t\right) }^{2}}\right) {x}^{\prime }\left( t\right) + {2x}\left( t\right) y\left( t\right) {y}^{\prime }\left( t\right) }\right) {dt}\]\n\n\[= {\int }_{0}^{1}\left( {\left( {{t}^{2} + 4{t}^{2}}\right) \left( 1\right) + {2t}\left( {2t}\right) \left( 2\right) }\right) {dt}\]\n\n\[= {\int }_{0}^{1}{13}{t}^{2}{dt}\]\n\n\[= {\left. \frac{{13}{t}^{3}}{3}\right| }_{0}^{1} = \frac{13}{3}\]\n\n(b) Since \( {x}^{\prime }\left( t\right) = 1 \) and \( {y}^{\prime }\left( t\right) = {4t} \), then\n\n\[{\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} = {\int }_{0}^{1}\left( {\left( {x{\left( t\right) }^{2} + y{\left( t\right) }^{2}}\right) {x}^{\prime }\left( t\right) + {2x}\left( t\right) y\left( t\right) {y}^{\prime }\left( t\right) }\right) {dt}\]\n\n\[= {\int }_{0}^{1}\left( {\left( {{t}^{2} + 4{t}^{4}}\right) \left( 1\right) + {2t}\left( {2{t}^{2}}\right) \left( {4t}\right) }\right) {dt}\]\n\n\[= {\int }_{0}^{1}\left( {{t}^{2} + {20}{t}^{4}}\right) {dt}\]\n\n\[= {\left. \frac{{t}^{3}}{3} + 4{t}^{5}\right| }_{0}^{1} = \frac{1}{3} + 4 = \frac{13}{3}\]
Yes
Evaluate \( {\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \), where \( C \) is the polygonal path from \( \left( {0,0}\right) \) to \( \left( {0,2}\right) \) to \( \left( {1,2}\right) \).
Solution: Write \( C = {C}_{1} \cup {C}_{2} \), where \( {C}_{1} \) is the curve given by \( x = 0, y = t \), \( 0 \leq t \leq 2 \) and \( {C}_{2} \) is the curve given by \( x = t, y = 2,0 \leq t \leq 1 \) (see Figure 4.1.5). Then\n\n\[ \n{\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} = {\int }_{{C}_{1}}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \n\]\n\n\[ \n+ {\int }_{{C}_{2}}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \n\]\n\n\[ \n= {\int }_{0}^{2}\left( {\left( {{0}^{2} + {t}^{2}}\right) \left( 0\right) + 2\left( 0\right) t\left( 1\right) }\right) {dt} + {\int }_{0}^{1}\left( {\left( {{t}^{2} + 4}\right) \left( 1\right) + {2t}\left( 2\right) \left( 0\right) }\right) {dt} \n\]\n\n\[ \n= {\int }_{0}^{2}{0dt} + {\int }_{0}^{1}\left( {{t}^{2} + 4}\right) {dt} \n\]\n\n\[ \n= {\left. \frac{{t}^{3}}{3} + 4t\right| }_{0}^{1} = \frac{1}{3} + 4 = \frac{13}{3} \n\]
Yes
Theorem 4.2. Let \( \mathbf{f}\left( {x, y}\right) = P\left( {x, y}\right) \mathbf{i} + Q\left( {x, y}\right) \mathbf{j} \) be a vector field, and let \( C \) be a smooth curve parametrized by \( x = x\left( t\right), y = y\left( t\right), a \leq t \leq b \) . Suppose that \( t = \alpha \left( u\right) \) for \( c \leq u \leq d \), such that \( a = \alpha \left( c\right), b = \alpha \left( d\right) \), and \( {\alpha }^{\prime }\left( u\right) > 0 \) on the open interval \( \left( {c, d}\right) \) (i.e. \( \alpha \left( u\right) \) is strictly increasing on \( \left\lbrack {c, d}\right\rbrack ) \) . Then \( {\int }_{C}\mathbf{f} \cdot d\mathbf{r} \) has the same value for the parametrizations \( x = x\left( t\right), y = y\left( t\right), a \leq t \leq b \) and \( x = \widetilde{x}\left( u\right) = x\left( {\alpha \left( u\right) }\right), y = \widetilde{y}\left( u\right) = y\left( {\alpha \left( u\right) }\right), c \leq u \leq d \) .
Proof: Since \( \alpha \left( u\right) \) is strictly increasing and maps \( \left\lbrack {c, d}\right\rbrack \) onto \( \left\lbrack {a, b}\right\rbrack \), then we know that \( t = \) \( \alpha \left( u\right) \) has an inverse function \( u = {\alpha }^{-1}\left( t\right) \) defined on \( \left\lbrack {a, b}\right\rbrack \) such that \( c = {\alpha }^{-1}\left( a\right), d = {\alpha }^{-1}\left( b\right) \) , and \( \frac{du}{dt} = \frac{1}{{\alpha }^{\prime }\left( u\right) } \) . Also, \( {dt} = {\alpha }^{\prime }\left( u\right) {du} \), and by the Chain Rule\n\n\[ \n{\widetilde{x}}^{\prime }\left( u\right) = \frac{d\widetilde{x}}{du} = \frac{d}{du}\left( {x\left( {\alpha \left( u\right) }\right) }\right) = \frac{dx}{dt}\frac{dt}{du} = {x}^{\prime }\left( t\right) {\alpha }^{\prime }\left( u\right) \; \Rightarrow \;{x}^{\prime }\left( t\right) = \frac{{\widetilde{x}}^{\prime }\left( u\right) }{{\alpha }^{\prime }\left( u\right) }\n\]\n\nso making the susbstitution \( t = \alpha \left( u\right) \) gives\n\n\[ \n{\int }_{a}^{b}P\left( {x\left( t\right), y\left( t\right) }\right) {x}^{\prime }\left( t\right) {dt} = {\int }_{{\alpha }^{-1}\left( a\right) }^{{\alpha }^{-1}\left( b\right) }P\left( {x\left( {\alpha \left( u\right) }\right), y\left( {\alpha \left( u\right) }\right) }\right) \frac{{\widetilde{x}}^{\prime }\left( u\right) }{{\alpha }^{\prime }\left( u\right) }\left( {{\alpha }^{\prime }\left( u\right) {du}}\right)\n\]\n\n\[ \n= {\int }_{c}^{d}P\left( {\widetilde{x}\left( u\right) ,\widetilde{y}\left( u\right) }\right) {\widetilde{x}}^{\prime }\left( u\right) {du}\n\]\n\nwhich shows that \( {\int }_{C}P\left( {x, y}\right) {dx} \) has the same value for both parametrizations. A similar argument shows that \( {\int }_{C}Q\left( {x, y}\right) {dy} \) has the same value for both parametrizations, and hence \( {\int }_{C}\mathbf{f} \cdot d\mathbf{r} \) has the same value.\n\nQED
Yes
Evaluate the line integral \( {\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \) from Example 4.2, Section 4.1, along the curve \( C : x = t, y = 2{t}^{2},0 \leq t \leq 1 \), where \( t = \sin u \) for \( 0 \leq u \leq \pi /2 \) .
Solution: First, we notice that \( 0 = \sin 0,1 = \sin \left( {\pi /2}\right) \), and \( \frac{dt}{du} = \cos u > 0 \) on \( \left( {0,\pi /2}\right) \) . So by Theorem 4.2 we know that if \( C \) is parametrized by\n\n\[ x = \sin u,\;y = 2{\sin }^{2}u,\;0 \leq u \leq \pi /2 \]\n\nthen \( {\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \) should have the same value as we found in Example 4.2, namely \( \frac{13}{3} \) . And we can indeed verify this:\n\n\[ {\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} = {\int }_{0}^{\pi /2}\left( {\left( {{\sin }^{2}u + {\left( 2{\sin }^{2}u\right) }^{2}}\right) \cos u + 2\left( {\sin u}\right) \left( {2{\sin }^{2}u}\right) 4\sin u\cos u}\right) {du} \]\n\n\[ = {\int }_{0}^{\pi /2}\left( {{\sin }^{2}u + {20}{\sin }^{4}u}\right) \cos {udu} \]\n\n\[ = {\left. \frac{{\sin }^{3}u}{3} + 4{\sin }^{5}u\right| }_{0}^{\pi /2} \]\n\n\[ = \frac{1}{3} + 4 = \frac{13}{3} \]\n\nIn other words, the line integral is unchanged whether \( t \) or \( u \) is the parameter for \( C \) .
Yes
In a region \( R \), the line integral \( {\int }_{C}\mathbf{f} \cdot d\mathbf{r} \) is independent of the path between any two points in \( R \) if and only if \( {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = 0 \) for every closed curve \( C \) which is contained in R.
Proof: Suppose that \( {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = 0 \) for every closed curve \( C \) which is contained in \( R \) . Let \( {P}_{1} \) and \( {P}_{2} \) be two distinct points in \( R \) . Let \( {C}_{1} \) be a curve in \( R \) going from \( {P}_{1} \) to \( {P}_{2} \), and let \( {C}_{2} \) be another curve in \( R \) going from \( {P}_{1} \) to \( {P}_{2} \), as in Figure 4.2.2.\n\nThen \( C = {C}_{1} \cup - {C}_{2} \) is a closed curve in \( R \) (from \( {P}_{1} \) to\n\n![347792f1-1f9a-4f04-ae91-1c56f986cc03_154_0.jpg](images/347792f1-1f9a-4f04-ae91-1c56f986cc03_154_0.jpg)\n\nFigure 4.2.2\n\n\( \left. {P}_{1}\right) \), and so \( {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = 0 \) . Thus,\n\n\[ 0 = {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} \]\n\n\[ = {\int }_{{C}_{1}}\mathbf{f} \cdot d\mathbf{r} + {\int }_{-{C}_{2}}\mathbf{f} \cdot d\mathbf{r} \]\n\n\[ = {\int }_{{C}_{1}}\mathbf{f} \cdot d\mathbf{r} - {\int }_{{C}_{2}}\mathbf{f} \cdot d\mathbf{r},\text{ and so } \]\n\n\( {\int }_{{C}_{1}}\mathbf{f} \cdot d\mathbf{r} = {\int }_{{C}_{2}}\mathbf{f} \cdot d\mathbf{r} \) . This proves path independence.\n\nConversely, suppose that the line integral \( {\int }_{C}\mathbf{f} \cdot d\mathbf{r} \) is independent of the path between any two points in \( R \) . Let \( C \) be a closed curve contained in \( R \) . Let \( {P}_{1} \) and \( {P}_{2} \) be two distinct points on \( C \) . Let \( {C}_{1} \) be a part of the curve \( C \) that goes from \( {P}_{1} \) to \( {P}_{2} \), and let \( {C}_{2} \) be the remaining part of \( C \) that goes from \( {P}_{1} \) to \( {P}_{2} \), again as in Figure 4.2.2. Then by path independence we have\n\n\[ {\int }_{{C}_{1}}\mathbf{f} \cdot d\mathbf{r} = {\int }_{{C}_{2}}\mathbf{f} \cdot d\mathbf{r} \]\n\n\[ {\int }_{{C}_{1}}\mathbf{f} \cdot d\mathbf{r} - {\int }_{{C}_{2}}\mathbf{f} \cdot d\mathbf{r} = 0 \]\n\n\[ {\int }_{{C}_{1}}\mathbf{f} \cdot d\mathbf{r} + {\int }_{-{C}_{2}}\mathbf{f} \cdot d\mathbf{r} = 0\text{, so } \]\n\n\[ {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = 0 \]\n\nsince \( C = {C}_{1} \cup - {C}_{2} \) .
Yes
Theorem 4.4. (Chain Rule) If \( z = f\left( {x, y}\right) \) is a continuously differentiable function of \( x \) and \( y \), and both \( x = x\left( t\right) \) and \( y = y\left( t\right) \) are differentiable functions of \( t \), then \( z \) is a differentiable function of \( t \), and\n\n\[ \frac{dz}{dt} = \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt} \]\n\n(4.19)\n\nat all points where the derivatives on the right are defined.
The proof is virtually identical to the proof of Theorem 2.2 from Section 2.4 (which uses the Mean Value Theorem), so we omit it.
No
Theorem 4.5. Let \( \mathbf{f}\left( {x, y}\right) = P\left( {x, y}\right) \mathbf{i} + Q\left( {x, y}\right) \mathbf{j} \) be a vector field in some region \( R \), with \( P \) and \( Q \) continuously differentiable functions on \( R \) . Let \( C \) be a smooth curve in \( R \) parametrized by \( x = x\left( t\right), y = y\left( t\right), a \leq t \leq b \) . Suppose that there is a real-valued function \( F\left( {x, y}\right) \) such that\n\n\( \nabla F = \mathbf{f} \) on \( R \) . Then\n\[{\int }_{C}\mathbf{f} \cdot d\mathbf{r} = F\left( B\right) - F\left( A\right)\]\n\nwhere \( A = \left( {x\left( a\right), y\left( a\right) }\right) \) and \( B = \left( {x\left( b\right), y\left( b\right) }\right) \) are the endpoints of \( C \) . Thus, the line integral is independent of the path between its endpoints, since it depends only on the values of \( F \) at those endpoints.
Proof: By definition of \( {\int }_{C}\mathbf{f} \cdot d\mathbf{r} \), we have\n\n\[{\int }_{C}\mathbf{f} \cdot d\mathbf{r} = {\int }_{a}^{b}\left( {P\left( {x\left( t\right), y\left( t\right) }\right) {x}^{\prime }\left( t\right) + Q\left( {x\left( t\right), y\left( t\right) }\right) {y}^{\prime }\left( t\right) }\right) {dt}\]\n\n\[= {\int }_{a}^{b}\left( {\frac{\partial F}{\partial x}\frac{dx}{dt} + \frac{\partial F}{\partial y}\frac{dy}{dt}}\right) {dt}\text{ (since }\nabla F = \mathbf{f} \Rightarrow \frac{\partial F}{\partial x} = P\text{ and }\frac{\partial F}{\partial y} = Q\text{ ) }\]\n\n\[= {\int }_{a}^{b}{F}^{\prime }\left( {x\left( t\right), y\left( t\right) }\right) {dt}\text{(by the Chain Rule in Theorem 4.4)}\]\n\n\[= {\left. F\left( x\left( t\right), y\left( t\right) \right) \right| }_{a}^{b} = F\left( B\right) - F\left( A\right)\]\n\nby the Fundamental Theorem of Calculus.
Yes
Recall from Examples 4.2 and 4.3 in Section 4.1 that the line integral \( {\int }_{C}\left( {{x}^{2} + }\right. \) \( \left. {y}^{2}\right) {dx} + {2xydy} \) was found to have the value \( \frac{13}{3} \) for three different curves \( C \) going from the point \( \left( {0,0}\right) \) to the point \( \left( {1,2}\right) \) . Use Theorem 4.5 to show that this line integral is indeed path independent.
Solution: We need to find a real-valued function \( F\left( {x, y}\right) \) such that\n\n\[ \frac{\partial F}{\partial x} = {x}^{2} + {y}^{2}\text{ and }\frac{\partial F}{\partial y} = {2xy}. \]\n\nSuppose that \( \frac{\partial F}{\partial x} = {x}^{2} + {y}^{2} \), Then we must have \( F\left( {x, y}\right) = \frac{1}{3}{x}^{3} + x{y}^{2} + g\left( y\right) \) for some function \( g\left( y\right) \) . So \( \frac{\partial F}{\partial y} = {2xy} + {g}^{\prime }\left( y\right) \) satisfies the condition \( \frac{\partial F}{\partial y} = {2xy} \) if \( {g}^{\prime }\left( y\right) = 0 \), i.e. \( g\left( y\right) = K \), where \( K \) is a constant. Since any choice for \( K \) will do (why?), we pick \( K = 0 \) . Thus, a potential \( F\left( {x, y}\right) \) for \( \mathbf{f}\left( {x, y}\right) = \left( {{x}^{2} + {y}^{2}}\right) \mathbf{i} + {2xy}\mathbf{j} \) exists, namely\n\n\[ F\left( {x, y}\right) = \frac{1}{3}{x}^{3} + x{y}^{2}. \]\n\nHence the line integral \( {\int }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \) is path independent.
Yes
Example 4.6. Evaluate \( {\oint }_{C}{xdx} + {ydy} \) for \( C : x = 2\cos t, y = 3\sin t,0 \leq t \leq {2\pi } \) .
Solution: The vector field \( \mathbf{f}\left( {x, y}\right) = x\mathbf{i} + y\mathbf{j} \) has a potential \( F\left( {x, y}\right) \) :\n\n\[ \n\frac{\partial F}{\partial x} = x \Rightarrow F\left( {x, y}\right) = \frac{1}{2}{x}^{2} + g\left( y\right) ,\text{ so } \n\] \n\n\[ \n\frac{\partial F}{\partial y} = y \Rightarrow {g}^{\prime }\left( y\right) = y \Rightarrow g\left( y\right) = \frac{1}{2}{y}^{2} + K \n\] \n\nfor any constant \( K \), so \( F\left( {x, y}\right) = \frac{1}{2}{x}^{2} + \frac{1}{2}{y}^{2} \) is a potential for \( \mathbf{f}\left( {x, y}\right) \) . Thus, \n\n\[ \n{\oint }_{C}{xdx} + {ydy} = {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = 0 \n\] \n\nby Corollary 4.6, since the curve \( C \) is closed (it is the ellipse \( \frac{{x}^{2}}{4} + \frac{{y}^{2}}{9} = 1 \) ).
Yes
Evaluate \( {\oint }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} \), where \( C \) is the boundary (traversed counterclockwise) of the region \( R = \left\{ {\left( {x, y}\right) : 0 \leq x \leq 1,2{x}^{2} \leq y \leq {2x}}\right\} \) .
Solution: \( R \) is the shaded region in Figure 4.3.2. By Green’s Theorem, for\n\n![347792f1-1f9a-4f04-ae91-1c56f986cc03_160_0.jpg](images/347792f1-1f9a-4f04-ae91-1c56f986cc03_160_0.jpg)\n\nFigure 4.3.2\n\n\( P\left( {x, y}\right) = {x}^{2} + {y}^{2} \) and \( Q\left( {x, y}\right) = {2xy} \), we have\n\n\[ \n{\oint }_{C}\left( {{x}^{2} + {y}^{2}}\right) {dx} + {2xydy} = {\iint }_{R}\left( {\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}}\right) {dA} \]\n\n\[ \n= {\iint }_{R}\left( {{2y} - {2y}}\right) {dA} = {\iint }_{R}{0dA} = 0. \]\n\nWe actually already knew that the answer was zero. Recall from Example 4.5 in Section 4.2 that the vector field \( \mathbf{f}\left( {x, y}\right) = \left( {{x}^{2} + {y}^{2}}\right) \mathbf{i} + {2xy}\mathbf{j} \) has a potential function \( F\left( {x, y}\right) = \frac{1}{3}{x}^{3} + x{y}^{2} \) , and so \( {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = 0 \) by Corollary 4.6.
Yes
Example 4.8. Let \( \mathbf{f}\left( {x, y}\right) = P\left( {x, y}\right) \mathbf{i} + Q\left( {x, y}\right) \mathbf{j} \), where\n\n\[ P\left( {x, y}\right) = \frac{-y}{{x}^{2} + {y}^{2}}\text{ and }Q\left( {x, y}\right) = \frac{x}{{x}^{2} + {y}^{2}}, \]\n\nand let \( R = \{ \left( {x, y}\right) : 0 < {x}^{2} + {y}^{2} \leq 1\} \) . For the boundary curve \( C : {x}^{2} + {y}^{2} = 1 \), traversed counterclockwise, it was shown in Exercise 9(b) in Section 4.2 that \( {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = {2\pi } \) . But\n\n\[ \frac{\partial Q}{\partial x} = \frac{{y}^{2} - {x}^{2}}{{\left( {x}^{2} + {y}^{2}\right) }^{2}} = \frac{\partial P}{\partial y} \Rightarrow {\iint }_{R}\left( {\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}}\right) {dA} = {\iint }_{R}{0dA} = 0. \]
This would seem to contradict Green’s Theorem. However, note that \( R \) is not the entire region enclosed by \( C \), since the point \( \left( {0,0}\right) \) is not contained in \( R \) . That is, \( R \) has a \
Yes
A torus \( T \) is a surface obtained by revolving a circle of radius \( a \) in the \( {yz} \) -plane around the \( z \) -axis, where the circle’s center is at a distance \( b \) from the z-axis \( \left( {0 < a < b}\right) \), as in Figure 4.4.3. Find the surface area of \( T \) .
Solution: For any point on the circle, the line segment from the center of the circle to that point makes an angle \( u \) with the \( y \) -axis in the positive \( y \) direction (see Figure 4.4.3(a)). And as the circle revolves around the \( z \) -axis, the line segment from the origin to the center of that circle sweeps out an angle \( v \) with the positive \( x \) -axis (see Figure 4.4.3(b)). Thus, the torus can be parametrized as:\n\n\[ x = \left( {b + a\cos u}\right) \cos v,\;y = \left( {b + a\cos u}\right) \sin v,\;z = a\sin u,\;0 \leq u \leq {2\pi },\;0 \leq v \leq {2\pi } \]\n\nSo for the position vector\n\n\[ \mathbf{r}\left( {u, v}\right) = x\left( {u, v}\right) \mathbf{i} + y\left( {u, v}\right) \mathbf{j} + z\left( {u, v}\right) \mathbf{k} \]\n\n\[ = \left( {b + a\cos u}\right) \cos v\mathbf{i} + \left( {b + a\cos u}\right) \sin v\mathbf{j} + a\sin u\mathbf{k} \]\n\nwe see that\n\n\[ \frac{\partial \mathbf{r}}{\partial u} = - a\sin u\cos v\mathbf{i} - a\sin u\sin v\mathbf{j} + a\cos u\mathbf{k} \]\n\n\[ \frac{\partial \mathbf{r}}{\partial v} = - \left( {b + a\cos u}\right) \sin v\mathbf{i} + \left( {b + a\cos u}\right) \cos v\mathbf{j} + 0\mathbf{k}, \]\n\nand so computing the cross product gives\n\n\[ \frac{\partial \mathbf{r}}{\partial u} \times \frac{\partial \mathbf{r}}{\partial v} = - a\left( {b + a\cos u}\right) \cos v\cos u\mathbf{i} - a\left( {b + a\cos u}\right) \sin v\cos u\mathbf{j} - a\left( {b + a\cos u}\right) \sin u\mathbf{k}, \]\n\nwhich has magnitude\n\n\[ \begin{Vmatrix}{\frac{\partial \mathbf{r}}{\partial u} \times \frac{\partial \mathbf{r}}{\partial v}}\end{Vmatrix} = a\left( {b + a\cos u}\right) . \]\n\nThus, the surface area of \( T \) is\n\n\[ S = {\iint }_{\sum }{1d\sigma } \]\n\n\[ = {\int }_{0}^{2\pi }{\int }_{0}^{2\pi }\begin{Vmatrix}{\frac{\partial \mathbf{r}}{\partial u} \times \frac{\partial \mathbf{r}}{\partial v}}\end{Vmatrix}{dudv} \]\n\n\[ = {\int }_{0}^{2\pi }{\int }_{0}^{2\pi }a\left( {b + a\cos u}\right) {dudv} \]\n\n\[ = {\int }_{0}^{2\pi }\left( {{abu} + {a}^{2}\sin u{\left. \right| }_{u = 0}^{u = {2\pi }}}\right) {dv} \]\n\n\[ = {\int }_{0}^{2\pi }{2\pi abdv} \]\n\n\[ = 4{\pi }^{2}{ab} \]
Yes
Theorem 4.8. (Divergence Theorem) Let \( \sum \) be a closed surface in \( {\mathbb{R}}^{3} \) which bounds a solid \( S \), and let \( \mathbf{f}\left( {x, y, z}\right) = {f}_{1}\left( {x, y, z}\right) \mathbf{i} + {f}_{2}\left( {x, y, z}\right) \mathbf{j} + {f}_{3}\left( {x, y, z}\right) \mathbf{k} \) be a vector field defined on some subset of \( {\mathbb{R}}^{3} \) that contains \( \sum \) . Then\n\n\[ \n{\iint }_{\sum }\mathbf{f} \cdot d\mathbf{\sigma } = {\iiint }_{S}\operatorname{div}\mathbf{f}{dV} \n\]\n\n(4.31)\n\nwhere\n\[ \n\operatorname{div}\mathbf{f} = \frac{\partial {f}_{1}}{\partial x} + \frac{\partial {f}_{2}}{\partial y} + \frac{\partial {f}_{3}}{\partial z} \n\]\n\n(4.32)\n\nis called the divergence of \( \mathbf{f} \) .
The proof of the Divergence Theorem is very similar to the proof of Green’s Theorem, i.e. it is first proved for the simple case when the solid \( S \) is bounded above by one surface, bounded below by another surface, and bounded laterally by one or more surfaces. The proof can then be extended to more general solids. \( {}^{3} \)
No
Evaluate \( {\iint }_{\sum }\mathbf{f} \cdot d\mathbf{\sigma } \), where \( \mathbf{f}\left( {x, y, z}\right) = x\mathbf{i} + y\mathbf{j} + z\mathbf{k} \) and \( \sum \) is the unit sphere \( {x}^{2} + {y}^{2} + {z}^{2} = 1 \)
Solution: We see that div \( \mathbf{f} = 1 + 1 + 1 = 3 \), so\n\n\[ \n{\iint }_{\sum }\mathbf{f} \cdot d\mathbf{\sigma } = {\iiint }_{S}\operatorname{div}\mathbf{f}{dV} = {\iiint }_{S}{3dV} \]\n\n\[ \n= 3{\iiint }_{S}{1dV} = 3\operatorname{vol}\left( S\right) = 3 \cdot \frac{{4\pi }{\left( 1\right) }^{3}}{3} = {4\pi }. \]\n
Yes
Theorem 4.9. If the flux of a vector field \( \mathbf{f} \) is zero through every closed surface containing a given point, then div \( \mathbf{f} = 0 \) at that point.
Proof: By formula (4.33), at the given point \( \left( {x, y, z}\right) \) we have\n\n\( \operatorname{div}\mathbf{f}\left( {x, y, z}\right) = \mathop{\lim }\limits_{{V \rightarrow 0}}\frac{1}{V}{\iint }_{\sum }\mathbf{f} \cdot d\mathbf{\sigma } \) for closed surfaces \( \sum \) containing \( \left( {x, y, z}\right) \), so\n\n\[ = \mathop{\lim }\limits_{{V \rightarrow 0}}\frac{1}{V}\left( 0\right) \text{ by our assumption that the flux through each }\sum \text{ is zero, so } \]\n\n\[ = \mathop{\lim }\limits_{{V \rightarrow 0}}0 \]\n\n\[ = 0\text{.} \]\n\nQED
Yes
Theorem 4.11. (Chain Rule) If \( w = f\\left( {x, y, z}\\right) \) is a continuously differentiable function of \( x, y \), and \( z \), and \( x = x\\left( t\\right), y = y\\left( t\\right) \) and \( z = z\\left( t\\right) \) are differentiable functions of \( t \), then \( w \) is a differentiable function of \( t \), and
\[ \frac{dw}{dt} = \frac{\\partial w}{\\partial x}\\frac{dx}{dt} + \frac{\\partial w}{\\partial y}\\frac{dy}{dt} + \frac{\\partial w}{\\partial z}\\frac{dz}{dt}. \]
Yes
Evaluate \( {\int }_{C}f\left( {x, y, z}\right) {ds} \) . (Note: \( C \) is called a conical helix. See Figure 4.5.1).
Solution: Since \( {x}^{\prime }\left( t\right) = \sin t + t\cos t,{y}^{\prime }\left( t\right) = \cos t - t\sin t \), and \( {z}^{\prime }\left( t\right) = 1 \), we have\n\n\[ {x}^{\prime }{\left( t\right) }^{2} + {y}^{\prime }{\left( t\right) }^{2} + {z}^{\prime }{\left( t\right) }^{2}\; = \;\left( {{\sin }^{2}t + {2t}\sin t\cos t + {t}^{2}{\cos }^{2}t}\right) + \left( {{\cos }^{2}t - {2t}\sin t\cos t + {t}^{2}{\sin }^{2}t}\right) + 1 \]\n\n\[ = {t}^{2}\left( {{\sin }^{2}t + {\cos }^{2}t}\right) + {\sin }^{2}t + {\cos }^{2}t + 1 \]\n\n\[ = {t}^{2} + 2 \]\n\nso since \( f\left( {x\left( t\right), y\left( t\right), z\left( t\right) }\right) = z\left( t\right) = t \) along the curve \( C \), then\n\n\[ {\int }_{C}f\left( {x, y, z}\right) {ds} = {\int }_{0}^{8\pi }f\left( {x\left( t\right), y\left( t\right), z\left( t\right) }\right) \sqrt{{x}^{\prime }{\left( t\right) }^{2} + {y}^{\prime }{\left( t\right) }^{2} + {z}^{\prime }{\left( t\right) }^{2}}{dt} \]\n\n\[ = {\int }_{0}^{8\pi }t\sqrt{{t}^{2} + 2}{dt} \]\n\n\[ = {\left. \left( \frac{1}{3}{\left( {t}^{2} + 2\right) }^{3/2}\right) \right| }_{0}^{8\pi }\; = \;\frac{1}{3}\left( {{\left( {64}{\pi }^{2} + 2\right) }^{3/2} - 2\sqrt{2}}\right) \;. \]\n\n
Yes
Let \( \mathbf{f}\left( {x, y, z}\right) = x\mathbf{i} + y\mathbf{j} + {2z}\mathbf{k} \) be a vector field in \( {\mathbb{R}}^{3} \) . Using the same curve \( C \) from Example 4.12, evaluate \( {\int }_{C}\mathbf{f} \cdot d\mathbf{r} \) .
Solution: It is easy to see that \( F\left( {x, y, z}\right) = \frac{{x}^{2}}{2} + \frac{{y}^{2}}{2} + {z}^{2} \) is a potential for \( \mathbf{f}\left( {x, y, z}\right) \) (i.e. \( \nabla F = \mathbf{f} \) ). So by Theorem 4.12 we know that\n\n\[{\int }_{C}\mathbf{f} \cdot d\mathbf{r} = F\left( B\right) - F\left( A\right) \text{, where}A = \left( {x\left( 0\right), y\left( 0\right), z\left( 0\right) }\right) \text{and}B = \left( {x\left( {8\pi }\right), y\left( {8\pi }\right), z\left( {8\pi }\right) }\right) \text{, so}\]\n\n\[= F\left( {{8\pi }\sin {8\pi },{8\pi }\cos {8\pi },{8\pi }}\right) - F\left( {0\sin 0,0\cos 0,0}\right)\]\n\n\[= F\left( {0,{8\pi },{8\pi }}\right) - F\left( {0,0,0}\right)\]\n\n\[= 0 + \frac{{\left( 8\pi \right) }^{2}}{2} + {\left( 8\pi \right) }^{2} - \left( {0 + 0 + 0}\right) = {96}{\pi }^{2}.\n\]
Yes
Theorem 4.14. (Stokes’ Theorem) Let \( \sum \) be an orientable surface in \( {\mathbb{R}}^{3} \) whose boundary is a simple closed curve \( C \), and let \( \mathbf{f}\left( {x, y, z}\right) = P\left( {x, y, z}\right) \mathbf{i} + Q\left( {x, y, z}\right) \mathbf{j} + R\left( {x, y, z}\right) \mathbf{k} \) be a smooth vector field defined on some subset of \( {\mathbb{R}}^{3} \) that contains \( \sum \) . Then\n\n\[ \n{\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = {\iint }_{\sum }\left( {\operatorname{curl}\mathbf{f}}\right) \cdot \mathbf{n}{d\sigma } \n\]\n\nwhere\n\[ \n\operatorname{curl}\mathbf{f} = \left( {\frac{\partial R}{\partial y} - \frac{\partial Q}{\partial z}}\right) \mathbf{i} + \left( {\frac{\partial P}{\partial z} - \frac{\partial R}{\partial x}}\right) \mathbf{j} + \left( {\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}}\right) \mathbf{k}, \n\]\n\n\( \mathbf{n} \) is a positive unit normal vector over \( \sum \), and \( C \) is traversed \( \mathbf{n} \) -positively.
Proof: As the general case is beyond the scope of this text, we will prove the theorem only for the special case where \( \sum \) is the graph of \( z = z\left( {x, y}\right) \) for some smooth real-valued function \( z\left( {x, y}\right) \), with \( \left( {x, y}\right) \) varying over a region \( D \) in \( {\mathbb{R}}^{2} \) .\n\nProjecting \( \sum \) onto the \( {xy} \) -plane, we see that the closed\n\n![347792f1-1f9a-4f04-ae91-1c56f986cc03_177_0.jpg](images/347792f1-1f9a-4f04-ae91-1c56f986cc03_177_0.jpg)\n\nFigure 4.5.4\n\ncurve \( C \) (the boundary curve of \( \sum \) ) projects onto a closed curve \( {C}_{D} \) which is the boundary curve of \( D \) (see Figure 4.5.4). Assuming that \( C \) has a smooth parametrization, its projection \( {C}_{D} \) in the \( {xy} \) -plane also has a smooth parametrization, say\n\n\[ \n{C}_{D} : x = x\left( t\right), y = y\left( t\right), a \leq t \leq b, \n\]\n\nand so \( C \) can be parametrized (in \( {\mathbb{R}}^{3} \) ) as\n\n\[ \nC : x = x\left( t\right), y = y\left( t\right), z = z\left( {x\left( t\right), y\left( t\right) }\right), a \leq t \leq b, \n\]\n\nsince the curve \( C \) is part of the surface \( z = z\left( {x, y}\right) \) . Now, by the Chain Rule (Theorem 4.4 in Section 4.2), for \( z = z\left( {x\left( t\right), y\left( t\right) }\right) \) as a function of \( t \), we know that\n\n\[ \n{z}^{\prime }\left( t\right) = \frac{\partial z}{\partial x}{x}^{\prime }\left( t\right) + \frac{\partial z}{\partial y}{y}^{\prime }\left( t\right) \n\]\n\nand so\n\n\[ \n{\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = {\int }_{C}P\left( {x, y, z}\right) {dx} + Q\left( {x, y, z}\right) {dy} + R\left( {x, y, z}\right) {dz} \n\]\n\n\[ \n= {\int }_{a}^{b}\left( {P{x}^{\prime }\left( t\right) + Q{y}^{\prime }\left( t\right) + R\left( {\frac{\partial z}{\partial x}{x}^{\prime }\left( t\right) + \frac{\partial z}{\partial y}{y}^{\prime }\left( t\right) }\right) }\right) {dt} \n\]\n\n\[ \n= {\int }_{a}^{b}\left( {\left( {P + R\frac{\partial z}{\partial x}}\right) {x}^{\prime }\left( t\right) + \left( {Q + R\frac{\partial z}{\partial y}}\right) {y}^{\prime }\left( t\right) }\right) {dt} \n\]\n\n\[ \n= {\int }_{{C}_{D}}\widetilde{P}\left( {x, y}\right) {dx} + \widetilde{Q}\left( {x, y}\right) {dy} \n\]\n\nwhere\n\n\[ \n\widetilde{P}\left( {x, y}\right) = P\left( {x, y, z\left( {x, y}\right) }\right) + R\left( {x, y, z\left( {x, y}\right) }\right) \frac{\partial z}{\partial x}\left( {x, y}\right) \text{, and} \n\]\n\n\[ \n\widetilde{Q}\left( {x, y}\right) = Q\left( {x, y, z\left( {x, y}\right) }\right) + R\left( {x, y, z\left( {x, y}\right) }\right) \frac{\partial z}{\partial y}\left( {x, y}\right) \n\]\n\nfor \( \left( {x, y}\right) \) in \( D \) . Thus, by Green’s Theorem applied to the region \( D \), we have\n\n\[ \n{\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = {\iint }_{D}\left( {\frac{\partial \widetilde{Q}}{\partial x} - \frac{\partial \widetilde{P}}{\partial y}}\right) {dA} \n\]\n\n(4.47
Yes
Let \( \sum \) be the elliptic paraboloid \( z = \frac{{x}^{2}}{4} + \frac{{y}^{2}}{9} \) for \( z \leq 1 \), and let \( C \) be its boundary curve. Calculate \( {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} \) for \( \mathbf{f}\left( {x, y, z}\right) = \left( {{9xz} + {2y}}\right) \mathbf{i} + \left( {{2x} + {y}^{2}}\right) \mathbf{j} + \left( {-2{y}^{2} + {2z}}\right) \mathbf{k} \), where \( C \) is traversed counterclockwise.
The surface is similar to the one in Example 4.14, except now the boundary curve \( C \) is the ellipse \( \frac{{x}^{2}}{4} + \frac{{y}^{2}}{9} = 1 \) laying in the plane \( z = 1 \) . In this case, using Stokes’ Theorem is easier than computing the line integral directly. As in Example 4.14, at each point \( \left( {x, y, z\left( {x, y}\right) }\right) \) on the surface \( z = z\left( {x, y}\right) = \frac{{x}^{2}}{4} + \frac{{y}^{2}}{9} \) the vector\n\n\[ \mathbf{n} = \frac{-\frac{\partial z}{\partial x}\mathbf{i} - \frac{\partial z}{\partial y}\mathbf{j} + \mathbf{k}}{\sqrt{1 + {\left( \frac{\partial z}{\partial x}\right) }^{2} + {\left( \frac{\partial z}{\partial y}\right) }^{2}}} = \frac{-\frac{x}{2}\mathbf{i} - \frac{2y}{9}\mathbf{j} + \mathbf{k}}{\sqrt{1 + \frac{{x}^{2}}{4} + \frac{4{y}^{2}}{9}}}, \]\n\n\nis a positive unit normal vector to \( \sum \) . And calculating the curl of \( \mathbf{f} \) gives\n\n\[ \operatorname{curl}\mathbf{f} = \left( {-{4y} - 0}\right) \mathbf{i} + \left( {{9x} - 0}\right) \mathbf{j} + \left( {2 - 2}\right) \mathbf{k} = - {4y}\mathbf{i} + {9x}\mathbf{j} + 0\mathbf{k}, \]\n\nso\n\n\[ \text{(curl}\mathbf{f}) \cdot \mathbf{n} = \frac{\left( {-{4y}}\right) \left( {-\frac{x}{2}}\right) + \left( {9x}\right) \left( {-\frac{2y}{9}}\right) + \left( 0\right) \left( 1\right) }{\sqrt{1 + \frac{{x}^{2}}{4} + \frac{4{y}^{2}}{9}}} = \frac{{2xy} - {2xy} + 0}{\sqrt{1 + \frac{{x}^{2}}{4} + \frac{4{y}^{2}}{9}}} = 0, \]\n\nand so by Stokes' Theorem\n\n\[ {\oint }_{C}\mathbf{f} \cdot d\mathbf{r} = {\iint }_{\sum }\left( {\operatorname{curl}\mathbf{f}}\right) \cdot \mathbf{n}{d\sigma } = {\iint }_{\sum }{0d\sigma } = 0. \]
Yes
Determine if the vector field \( \mathbf{f}\left( {x, y, z}\right) = {xyz}\mathbf{i} + {xz}\mathbf{j} + {xy}\mathbf{k} \) has a potential in \( {\mathbb{R}}^{3} \).
Solution: Since \( {\mathbb{R}}^{3} \) is simply connected, we just need to check whether curl \( \mathbf{f} = \mathbf{0} \) throughout \( {\mathbb{R}}^{3} \), that is,\n\n\[ \frac{\partial R}{\partial y} = \frac{\partial Q}{\partial z},\;\frac{\partial P}{\partial z} = \frac{\partial R}{\partial x},\;\text{ and }\;\frac{\partial Q}{\partial x} = \frac{\partial P}{\partial y} \]\n\nthroughout \( {\mathbb{R}}^{3} \), where \( P\left( {x, y, z}\right) = {xyz}, Q\left( {x, y, z}\right) = {xz} \), and \( R\left( {x, y, z}\right) = {xy} \) . But we see that\n\n\[ \frac{\partial P}{\partial z} = {xy},\frac{\partial R}{\partial x} = y\; \Rightarrow \;\frac{\partial P}{\partial z} \neq \frac{\partial R}{\partial x}\text{ for some }\left( {x, y, z}\right) \text{ in }{\mathbb{R}}^{3}. \]\n\nThus, \( \mathbf{f}\left( {x, y, z}\right) \) does not have a potential in \( {\mathbb{R}}^{3} \).
Yes
Find (a) the gradient of \( \parallel \mathbf{r}{\parallel }^{2} \) (b) the divergence of \( \mathbf{r} \) (c) the curl of \( \mathbf{r} \) (d) the Laplacian of \( \parallel \mathbf{r}{\parallel }^{2} \)
Solution: (a) \( \nabla \parallel \mathbf{r}{\parallel }^{2} = {2x}\mathbf{i} + {2y}\mathbf{j} + {2z}\mathbf{k} = 2\mathbf{r} \)\n\n(b) \( \nabla \cdot \mathbf{r} = \frac{\partial }{\partial x}\left( x\right) + \frac{\partial }{\partial y}\left( y\right) + \frac{\partial }{\partial z}\left( z\right) = 1 + 1 + 1 = 3 \)\n\n(c)\n\n\[ \nabla \times \mathbf{r} = \left| \begin{matrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ \frac{\partial }{\partial x} & \frac{\partial }{\partial y} & \frac{\partial }{\partial z} \\ x & y & z \end{matrix}\right| = \left( {0 - 0}\right) \mathbf{i} - \left( {0 - 0}\right) \mathbf{j} + \left( {0 - 0}\right) \mathbf{k} = \mathbf{0} \]\n\n(d) \( \Delta \parallel \mathbf{r}{\parallel }^{2} = \frac{{\partial }^{2}}{\partial {x}^{2}}\left( {{x}^{2} + {y}^{2} + {z}^{2}}\right) + \frac{{\partial }^{2}}{\partial {y}^{2}}\left( {{x}^{2} + {y}^{2} + {z}^{2}}\right) + \frac{{\partial }^{2}}{\partial {z}^{2}}\left( {{x}^{2} + {y}^{2} + {z}^{2}}\right) = 2 + 2 + 2 = 6 \)
Yes
Theorem 4.15. For any smooth real-valued function \( f\left( {x, y, z}\right) ,\nabla \times \left( {\nabla f}\right) = \mathbf{0} \) .
Proof: We see by the smoothness of \( f \) that\n\n\[ \nabla \times \left( {\nabla f}\right) = \left| \begin{matrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ \frac{\partial }{\partial x} & \frac{\partial }{\partial y} & \frac{\partial }{\partial z} \\ \frac{\partial f}{\partial x} & \frac{\partial f}{\partial y} & \frac{\partial f}{\partial z} \end{matrix}\right| \]\n\n\[ = \left( {\frac{{\partial }^{2}f}{\partial y\partial z} - \frac{{\partial }^{2}f}{\partial z\partial y}}\right) \mathbf{i} - \left( {\frac{{\partial }^{2}f}{\partial x\partial z} - \frac{{\partial }^{2}f}{\partial z\partial x}}\right) \mathbf{j} + \left( {\frac{{\partial }^{2}f}{\partial x\partial y} - \frac{{\partial }^{2}f}{\partial y\partial x}}\right) \mathbf{k} = \mathbf{0}, \]\n\nsince the mixed partial derivatives in each component are equal.\n\nQED
Yes
Theorem 4.17. For any smooth vector field \( \mathbf{f}\left( {x, y, z}\right) ,\nabla \cdot \left( {\nabla \times \mathbf{f}}\right) = 0 \) .
The proof is straightforward and left as an exercise for the reader.
No
Corollary 4.18. The flux of the curl of a smooth vector field \( \mathbf{f}\left( {x, y, z}\right) \) through any closed surface is zero.
Proof: Let \( \sum \) be a closed surface which bounds a solid \( S \) . The flux of \( \nabla \times \mathbf{f} \) through \( \sum \) is\n\n\[{\iint }_{\sum }\left( {\nabla \times \mathbf{f}}\right) \cdot d\mathbf{\sigma } = {\iiint }_{S}\nabla \cdot \left( {\nabla \times \mathbf{f}}\right) {dV}\;\text{ (by the Divergence Theorem) }\]\n\n\[= {\iiint }_{S}{0dV}\;\text{ (by Theorem 4.17) }\]\n\n\[= 0\text{.}\]\n\nQED
Yes
Show that \( \nabla \cdot \mathbf{E} = {4\pi \rho } \) . This is one of Maxwell’s Equations. \( {}^{10} \) In Gaussian (or CGS) units.
Solution: By the Divergence Theorem, we have\n\n\[ \n{\iiint }_{S}\nabla \cdot \mathbf{E}{dV} = {\iint }_{\sum }\mathbf{E} \cdot d\mathbf{\sigma }\n\]\n\n\[ \n= {4\pi }{\iiint }_{S}{\rho dV}\;\text{by Gauss’ Law, so combining the integrals gives}\n\]\n\n\[ \n{\iiint }_{S}\left( {\nabla \cdot \mathbf{E} - {4\pi \rho }}\right) {dV} = 0\text{, so }\n\]\n\n\[ \n\nabla \cdot \mathbf{E} - {4\pi \rho } = 0\;\text{since}\;\sum \;\text{and hence}\;S\;\text{was arbitrary, so}\n\]\n\n\[ \n\nabla \cdot \mathbf{E} = {4\pi \rho }\n\]
Yes
Example 4.19. In Example 4.17 we showed that \( \nabla \parallel \mathbf{r}{\parallel }^{2} = 2\mathbf{r} \) and \( \Delta \parallel \mathbf{r}{\parallel }^{2} = 6 \), where \( \mathbf{r}\left( {x, y, z}\right) = \) \( x\mathbf{i} + y\mathbf{j} + z\mathbf{k} \) in Cartesian coordinates. Verify that we get the same answers if we switch to spherical coordinates.
Solution: Since \( \parallel \mathbf{r}{\parallel }^{2} = {x}^{2} + {y}^{2} + {z}^{2} = {\rho }^{2} \) in spherical coordinates, let \( F\left( {\rho ,\theta ,\phi }\right) = {\rho }^{2} \) (so that \( F\left( {\rho ,\theta ,\phi }\right) = \parallel \mathbf{r}{\parallel }^{2} \) ). The gradient of \( F \) in spherical coordinates is\n\n\[ \nabla F = \frac{\partial F}{\partial \rho }{\mathbf{e}}_{\rho } + \frac{1}{\rho \sin \phi }\frac{\partial F}{\partial \theta }{\mathbf{e}}_{\theta } + \frac{1}{\rho }\frac{\partial F}{\partial \phi }{\mathbf{e}}_{\phi } \]\n\n\[ = {2\rho }{\mathbf{e}}_{\rho } + \frac{1}{\rho \sin \phi }\left( 0\right) {\mathbf{e}}_{\theta } + \frac{1}{\rho }\left( 0\right) {\mathbf{e}}_{\phi } \]\n\n\[ = {2\rho }{\mathbf{e}}_{\rho } = {2\rho }\frac{\mathbf{r}}{\parallel \mathbf{r}\parallel }\text{, as we showed earlier, so} \]\n\n\[ = {2\rho }\frac{\mathbf{r}}{\rho } = 2\mathbf{r}\text{, as expected. And the Laplacian is} \]\n\n\[ {\Delta F} = \frac{1}{{\rho }^{2}}\frac{\partial }{\partial \rho }\left( {{\rho }^{2}\frac{\partial F}{\partial \rho }}\right) + \frac{1}{{\rho }^{2}{\sin }^{2}\phi }\frac{{\partial }^{2}F}{\partial {\theta }^{2}} + \frac{1}{{\rho }^{2}\sin \phi }\frac{\partial }{\partial \phi }\left( {\sin \phi \frac{\partial F}{\partial \phi }}\right) \]\n\n\[ = \frac{1}{{\rho }^{2}}\frac{\partial }{\partial \rho }\left( {{\rho }^{2}{2\rho }}\right) + \frac{1}{{\rho }^{2}\sin \phi }\left( 0\right) + \frac{1}{{\rho }^{2}\sin \phi }\frac{\partial }{\partial \phi }\left( {\sin \phi \left( 0\right) }\right) \]\n\n\[ = \frac{1}{{\rho }^{2}}\frac{\partial }{\partial \rho }\left( {2{\rho }^{3}}\right) + 0 + 0 \]\n\n\[ = \frac{1}{{\rho }^{2}}\left( {6{\rho }^{2}}\right) = 6\text{, as expected. } \]
Yes
Consider the system of linear equations represented by the augmented matrix\n\n\[ B = \left\lbrack \begin{matrix} 1 & 2 & 3 & 4 \\ 0 & - 2 & - 4 & 6 \\ 1 & - 1 & 0 & 0 \end{matrix}\right\rbrack \]\n\nUse row operations to put \( B \) into row echelon form, then solve by backward substitution. Compare to the row-reduced echelon form computed by Octave.
Solution. The first operation is to replace row 3 with -1 times row 1, added to row 3.\n\n\( > > \% \) new row \( 3 = - 1 * \) row \( 1 + \) row 3\n\n\( > > \mathrm{B}\left( {3, : }\right) = \left( {-1}\right) * \mathrm{\;B}\left( {1, : }\right) + \mathrm{B}\left( {3, : }\right) \)\n\nans \( = \)\n\n\[ \begin{array}{llll} 1 & 2 & 3 & 4 \end{array} \]\n\n\[ \begin{array}{llll} 0 & - 2 & - 4 & 6 \end{array} \]\n\n\[ \begin{array}{llll} 0 & - 3 & - 3 & - 4 \end{array} \]\n\nNext, we will replace row 3 with -1.5 times row 2, added to row 3.\n\n\( > > \% \) new row \( 3 = - {1.5} * \) row \( 2 + \) row 3\n\n\( > > \mathrm{B}\left( {3, : }\right) = - {1.5} * \mathrm{\;B}\left( {2, : }\right) + \mathrm{B}\left( {3, : }\right) \)\n\nans \( = \)\n\n\[ \begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & - 2 & - 4 & 6 \\ 0 & 0 & 3 & - {13} \end{array} \]\n\nThe matrix is now in row echelon form. We could continue using row operations to reach row-reduced echelon form, but it is more efficient to simply write out the corresponding linear system on paper and solve by backward substitution. The solution vector is \( \left\langle {\frac{17}{3},\frac{17}{3}, - \frac{13}{3}}\right\rangle \) .\n\nOctave also has a built-in command, rref, to find the row-reduced echelon form of the matrix directly.\n\n\[ \text{ >> rref (B) } \]\n\nans \( = \)\n\n\[ \begin{array}{rrrr} {1.00000} & {0.00000} & {0.00000} & {5.66667} \\ {0.00000} & {1.00000} & {0.00000} & {5.66667} \\ {0.00000} & {0.00000} & {1.00000} & - {4.33333} \end{array} \]\n\nFrom here, the solution to the system is evident. Notice that everything is now expressed as floating point numbers (i.e., decimals). Five decimal places are displayed by default. The variables are actually stored with higher precision and it is possible to display more decimal places, if desired (type: format long).
Yes
Example 2.1.2. Use left division to solve the system of equations with augmented matrix \( B \) .\n\n\[ B = \left\lbrack \begin{matrix} 1 & 2 & 3 & 4 \\ 0 & - 2 & - 4 & 6 \\ 1 & - 1 & 0 & 0 \end{matrix}\right\rbrack \]
Solution. To use left division, we need to extract the coefficient matrix and vector of right-side constants. Let’s call the coefficient matrix \( A \) and the right-side constants \( \mathbf{b} \) . (You have probably already noticed that Octave is case-sensitive.)\n\n\( > > \mathrm{B} = \left\lbrack \begin{array}{llllllllllll} 1 & 2 & 3 & 4; & 0 & - 2 & - 4 & 6; & 1 & - 1 & 0 & 0 \end{array}\right\rbrack \;\% \) re-enter \( \mathrm{B} \), if necessary\n\n\( \mathrm{B} = \)\n\n\[ \begin{array}{rrrr} 1 & 2 & 3 & 4 \\ 0 & - 2 & - 4 & 6 \\ 1 & - 1 & 0 & 0 \end{array} \]\n\n\( > > \mathrm{A} = \mathrm{B}\left( { : ,1 : 3}\right) \% \) extract coefficient matrix \( \mathrm{A} = \)\n\n\[ \begin{array}{rrr} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 1 & - 1 & 0 \end{array} \]\n\n\( > > \mathrm{b} = \mathrm{B}\left( { : ,4}\right) \;\% \) extract right side constants \( \mathrm{b} = \) 4 6 0 \( \gg \mathrm{A} \smallsetminus \mathrm{b}\;\% \) solve system \( \mathrm{{Ax}} = \mathrm{b} \) ans \( = \) 5.6667 5.6667 \( - {4.3333} \)\n\nThe solution vector matches what we found by Gaussian elimination.
Yes
Find an \( {LU} \) decomposition for\n\n\[ A = \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 1 & - 1 & 0 \end{matrix}\right\rbrack \]
Solution. This is the same coefficient matrix we row-reduced in Example 2.1.1. We proceed the same way, carefully noting the multiplier used to obtain each 0 . The lower triangular \( L \) starts as an identity matrix, then the negative of each multiplier used in the elimination process is placed into the corresponding entry of \( L \) .\n\nThe first zero in position \( \left( {2,1}\right) \) is already there, so we put 0 for that multiplier in the corresponding position of \( L \) . Then we replace row 3 with -1 times row 1 plus row 3 . The negative of this multiplier is \( - \left( {-1}\right) = 1 \), which is entered in \( L \) at the point where the 0 was obtained.\n\nAt this point, we have two entries for \( L \) along with a partly reduced \( A \) :\n\n\[ A = \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 1 & - 1 & 0 \end{matrix}\right\rbrack \rightarrow \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 0 & - 3 & - 3 \end{matrix}\right\rbrack ;L = \left\lbrack \begin{array}{lll} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 1 & ? & 1 \end{array}\right\rbrack \]\n\nThe next step is to replace row 3 using -1.5 times row 2. Thus we put \( - \left( {-{1.5}}\right) = {1.5} \) in the corresponding position of \( L \) . Once \( A \) has reached row echelon form, we have the desired upper triangular matrix \( U \) .\n\n\[ A = \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 1 & - 1 & 0 \end{matrix}\right\rbrack \rightarrow \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 0 & - 3 & - 3 \end{matrix}\right\rbrack \rightarrow \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 0 & 0 & 3 \end{matrix}\right\rbrack = U \]\n\n\[ L = \left\lbrack \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 1 & {1.5} & 1 \end{matrix}\right\rbrack, U = \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 0 & 0 & 3 \end{matrix}\right\rbrack \]\n\nSo, to review, \( U \) is the row echelon form of \( A \) and \( L \) is an identity matrix with the negatives of the Gaussian elimination multipliers placed into the corresponding positions where they were used to obtain zeros.
Yes
Solve \( A\mathbf{x} = \mathbf{b} \), where \( A = \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 1 & - 1 & 0 \end{matrix}\right\rbrack \) and \( \mathbf{b} = \left\lbrack \begin{array}{l} 4 \\ 6 \\ 0 \end{array}\right\rbrack \), using \( {LU} \) decomposition.
Solution. We already have the \( {LU} \) decomposition. Since \( L = \left\lbrack \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 1 & {1.5} & 1 \end{matrix}\right\rbrack \), the first step\n\nis to solve:\n\[ \left\lbrack \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 1 & {1.5} & 1 \end{matrix}\right\rbrack \cdot \left\lbrack \begin{array}{l} {y}_{1} \\ {y}_{2} \\ {y}_{3} \end{array}\right\rbrack = \left\lbrack \begin{array}{l} 4 \\ 6 \\ 0 \end{array}\right\rbrack \]\n\nThe corresponding systems of equations is\n\n\[ {y}_{1}\; = \;4 \]\n\n\[ {y}_{2}\; = \;6 \]\n\n\[ {y}_{1} + {1.5}{y}_{2} + {y}_{3} = 0 \]\n\nStarting with the first row and working down, this system is easily solved by forward substitution. We can see that \( {y}_{1} = 4 \) and \( {y}_{2} = 6 \) . Substituting these values into the third equation and solving for \( {y}_{3} \) gives \( {y}_{3} = - {13} \) . Thus the intermediate solution for \( \mathbf{y} \) is \( \left\lbrack \begin{matrix} 4 \\ 6 \\ - {13} \end{matrix}\right\rbrack \) .\n\nStep two is to solve \( U\mathbf{x} = \mathbf{y} \), which looks like:\n\n\[ \left\lbrack \begin{matrix} 1 & 2 & 3 \\ 0 & - 2 & - 4 \\ 0 & 0 & 3 \end{matrix}\right\rbrack \cdot \left\lbrack \begin{array}{l} {x}_{1} \\ {x}_{2} \\ {x}_{3} \end{array}\right\rbrack = \left\lbrack \begin{matrix} 4 \\ 6 \\ - {13} \end{matrix}\right\rbrack \]\n\nThis is easily solved by backward substitution to get \( \mathbf{x} = \left\lbrack \begin{matrix} {17}/3 \\ {17}/3 \\ - {13}/3 \end{matrix}\right\rbrack \) .
Yes
Find an \( {LU} \) decomposition (with permutation) for\n\n\[ A = \left\lbrack \begin{array}{rrrr} - 7 & - 2 & 9 & 4 \\ - 4 & - 9 & 3 & 0 \\ - 3 & 4 & 6 & - 2 \\ 6 & 7 & - 4 & - 8 \end{array}\right\rbrack \]
Solution. We will use Octave for this.\n\n\[ \begin{array}{l} > > \mathrm{A} = \left\lbrack \begin{array}{llllllllllllllll} - 7 & - 2 & 9 & 4; & - 4 & - 9 & 3 & 0; & - 3 & 4 & 6 & - 2; & 6 & 7 & - 4 & - 8 \end{array}\right\rbrack \\ \mathrm{A} = \end{array} \]\n\n\[ \begin{array}{llll} - 7 & - 2 & 9 & 4 \end{array} \]\n\n\[ \begin{array}{llll} - 4 & - 9 & 3 & 0 \end{array} \]\n\n\[ \begin{array}{llll} - 3 & 4 & 6 & - 2 \end{array} \]\n\n\[ \begin{array}{llll} 6 & 7 & - 4 & - 8 \end{array} \]\n\n\[ \begin{array}{l} > > \left\lbrack {\mathrm{L}\mathrm{U}\mathrm{P}}\right\rbrack = \mathrm{{lu}}\left( \mathrm{A}\right) \\ \mathrm{L} = \end{array} \]\n\n\[ \begin{array}{llll} {1.00000} & {0.00000} & {0.00000} & {0.00000} \end{array} \]\n\n\[ \begin{array}{llll} {0.57143} & {1.00000} & {0.00000} & {0.00000} \end{array} \]\n\n\[ \begin{array}{llll} - {0.85714} & - {0.67273} & {1.00000} & {0.00000} \end{array} \]\n\n\[ \begin{array}{llll} {0.42857} & - {0.61818} & {0.36000} & {1.00000} \end{array} \]\n\n\( \mathrm{U} = \)\n\n\[ \begin{array}{llll} - {7.00000} & - {2.00000} & {9.00000} & {4.00000} \end{array} \]\n\n\[ \begin{array}{llll} {0.00000} & - {7.85714} & - {2.14286} & - {2.28571} \end{array} \]\n\n\[ \begin{array}{llll} {0.00000} & {0.00000} & {2.27273} & - {6.10909} \end{array} \]\n\n\[ \begin{array}{llll} {0.00000} & {0.00000} & {0.00000} & - {2.92800} \end{array} \]\n\n\( \mathrm{P} = \)\n\nPermutation Matrix\n\n\( \begin{array}{llll} 1 & 0 & 0 & 0 \end{array} \)\n\n\( \begin{array}{llll} 0 & 1 & 0 & 0 \end{array} \)\n\n\[ \begin{array}{llll} 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{array} \]\n\nThen we have the factorization \( {PA} = {LU} \), where \( {PA} \) is a row-permutation of \( A \) .
Yes
Example 2.2.2. Use polyfit to find the least-squares parabola for the following data:
Solution. This is the same data as in Example 2.2.1. Re-enter the data values if necessary.\n\nWe use polyfit to determine the equation, then the polyval function to evaluate the polynomial at the given \( x \) -values.\n\n\( > > \mathrm{P} = \) polyfit \( \left( {\mathrm{{xdata}},\mathrm{{ydata}},2}\right) \% \) degree two polynomial fit\n\n\[ \mathrm{P} = \]\n\n\[ - {0.89286}\;{5.65000}\; - {4.40000} \]\n\n\( \gg \mathrm{y} = \operatorname{polyval}\left( {\mathrm{P},\text{ xdata }}\right) ;\% \) evaluate polynomial \( \mathrm{P} \) at input xdata\n\n\( > > \) plot \( \left( {\text{xdata},\text{ydata},\text{'o-'},\text{xdata},\text{y},\text{'+'}}\right) \) ;\n\n\( > > \) grid on;\n\n\( > > \) legend('original data','polyfit data');\n\nThe graph is shown in Figure 2.2.
Yes
Rotate the house graph through \( {90}^{ \circ } \) and \( {225}^{ \circ } \).
Solution. Note that each \( \theta \) must be converted to radians. Here we go:\n\n\( > > D = \left\lbrack \begin{array}{llllllllllllll} 1 & 1 & 3 & 3 & 2 & 1 & 3; & 2 & 0 & 0 & 2 & 3 & 2 & 2 \end{array}\right\rbrack \) ;\n\n\( > > \mathrm{x} = \mathrm{D}\left( {1, : }\right) \) ;\n\n\( > > \mathrm{y} = \mathrm{D}\left( {2, : }\right) \) ;\n\n>> % execute a 90 degree rotation\n\n\( > > \) theta1 \( = {90} * \mathrm{{pi}}/{180} \) ;\n\n\( > > \mathrm{R}1 = \left\lbrack {\cos \left( \text{theta1}\right) - \sin \left( \text{theta1}\right) ;\sin \left( \text{theta1}\right) \cos \left( \text{theta1}\right) }\right\rbrack \) ;\n\n\( > > \mathrm{{RD}}1 = \mathrm{R}1 * \mathrm{D} \) ;\n\n\( > > \mathrm{x}1 = \mathrm{{RD}}1\left( {1, : }\right) \) ;\n\n\( > > \mathrm{y}1 = \mathrm{{RD}}1\left( {2, : }\right) \) ;\n\n\( > > \% \) execute a 225 degree rotation\n\n\( > > \) theta2 \( = {225} * \mathrm{{pi}}/{180} \) ;\n\n\( > > \mathrm{R}2 = \left\lbrack {\cos \left( {\text{theta}2}\right) - \sin \left( {\text{theta}2}\right) ;\sin \left( {\text{theta}2}\right) \cos \left( {\text{theta}2}\right) }\right\rbrack \) ;\n\n\( > > \mathrm{{RD}}2 = \mathrm{R}2 * \mathrm{D} \) ;\n\n\( > > \mathrm{x}2 = \mathrm{{RD}}2\left( {1, : }\right) \) ;\n\n\( > > \mathrm{y}2 = \mathrm{{RD}}2\left( {2, : }\right) \) ;\n\n\( > > \% \) plot original and rotated figures\n\n\( > > \) plot \( \left( {\mathrm{x},\mathrm{y},{}^{\prime }\mathrm{{bo}} - {}^{\prime },\mathrm{x}1,\mathrm{y}1,{}^{\prime }\mathrm{{ro}} - {}^{\prime },\mathrm{x}2,\mathrm{y}2,{}^{\prime }\mathrm{{mo}} - {}^{\prime }}\right) \)\n\n![c6a99c62-f1ae-42a9-87a0-435f643c2ede_41_0.jpg](images/c6a99c62-f1ae-42a9-87a0-435f643c2ede_41_0.jpg)\n\nFigure 2.4: Rotations of the house graph\n\n\( > > \operatorname{axis}\left( {\left\lbrack \begin{array}{llll} - 4 & 4 & - 4 & 4 \end{array}\right\rbrack ,\text{ ’equal’ }}\right) \) ;\n\n\( \gg \) grid on;\n\n\( \gg \) legend \( \left( {{}^{\prime }\text{original}{}^{\prime },{}^{\prime }}\right. \) rotated \( {90}{\mathrm{{deg}}}^{\prime },{}^{\prime } \) rotated \( {225}{\mathrm{{deg}}}^{\prime } \) );\n\nNote the combined plot options to set color, marker, and line styles. The original and rotated graphs are shown in Figure 2.4. Notice that the rotation is about the origin. For rotations about an arbitrary point, see Exercise 14.
Yes
Example 2.3.2. Reflect the house graph in the line \( y = x \) .
Solution. With the data matrix \( D \) and the original \( x \) and \( y \) vectors already defined, and using \( R \) as determined above, we have:\n\n\[ \mathrm{R} = \left\lbrack \begin{array}{llll} 0 & 1; & 1 & 0 \end{array}\right\rbrack \]\n\n\( \mathrm{R} = \)\n\n\( \begin{array}{ll} 0 & 1 \end{array} \)\n\n\( \begin{array}{ll} 1 & 0 \end{array} \)\n\n\( > > \mathrm{{RD}} = \mathrm{R} * \mathrm{D} \) ;\n\n\( > > \mathrm{x}1 = \mathrm{{RD}}\left( {1, : }\right) \) ;\n\n>> y1 = RD(2, :);\n\n\( > > \operatorname{plot}\left( {\mathrm{x},\mathrm{y},{}^{\prime }\mathrm{o} - {}^{\prime },\mathrm{x}1,\mathrm{y}1,{}^{\prime }\mathrm{o} - {}^{\prime }}\right) \)\n\n\( > > \operatorname{axis}\left( {\left\lbrack \begin{array}{llll} - 1 & 4 & - 1 & 4 \end{array}\right\rbrack ,\text{ ’equal’ }}\right) \) ;\n\n\( > > \) grid on;\n\n>> legend('original', 'reflected')\n\nThe result is shown in Figure 2.5.
Yes
Example 2.3.3. Expand the house graph by a factor of 2.
Solution. To scale by a factor of 2, we only need to multiply \( D \) by the matrix \( \left\lbrack \begin{array}{ll} 2 & 0 \\ 0 & 2 \end{array}\right\rbrack \) .
Yes
Example 3.1.1. Let \( \mathop{\sum }\limits_{{n = 2}}^{\infty }{a}_{n} \) be the series whose \( n \) th term is \( {a}_{n} = \frac{1}{n\left( {n + 2}\right) } \) . Find the first ten terms, the first ten partial sums, and plot the sequence and partial sums.
Solution. To do this, we will define an index vector \( n \) from 2 to 11, then calculate the terms.\n\n\( \gg \mathrm{n} = {\left\lbrack \begin{array}{lll} 2 & : & {11} \end{array}\right\rbrack }^{\prime };\;\% \) index\n\n\( \gg \mathrm{a} = 1./\left( {\mathrm{n} \cdot * \left( {\mathrm{n} + 2}\right) }\right) \% \) terms of the sequence\n\n\( \mathrm{a} = \)\n\n0.1250000\n\n0.0666667\n\n0.0416667\n\n0.0285714\n\n0.0208333\n\n0.0158730\n\n0.0125000\n\n0.0101010\n\n0.0083333\n\n0.0069930\n\nIf we want to know the 10th partial sum, we need only type sum(a). If we want to produce the sequence of partial sums, we need to make careful use of a loop. We will use a for loop with index \( i \) from 1 to 10 . For each \( i \), we produce a partial sum of the sequence \( {a}_{n} \) from the first term to the \( i \) th term. The output is a 10-element vector of these partial sums.\n\n\( > > \) for \( \mathrm{i} = 1 : {10} \)\n\n\( \mathrm{s}\left( \mathrm{i}\right) = \operatorname{sum}\left( {\mathrm{a}\left( {1 : \mathrm{i}}\right) }\right) \)\n\nend\n\n\( \gg {\mathrm{s}}^{\prime }\% \) sequence of partial sums, displayed as a column vector\n\nans \( = \)\n\n0.12500\n\n0.19167\n\n0.23333\n\n0.26190\n\n0.28274\n\n0.29861\n\n0.31111\n\n0.32121\n\n0.32955\n\n0.33654\n\nFinally, we will plot the terms and partial sums, for \( 2 \leq n \leq {11} \).\n\n\( > > \operatorname{plot}\left( {\mathrm{n},\mathrm{a},{}^{\prime }{\mathrm{o}}^{\prime },\mathrm{n},\mathrm{s},{}^{\prime } + {}^{\prime }}\right) \)\n\n\( > > \) grid on\n\n\( > > \) legend \( \left( {{}^{\prime }\text{terms}\left. {{}^{\prime },{}^{\prime }\text{partial sums}{}^{\prime }}\right) }\right. \)
Yes
Find the sum of the first 1000 terms of the harmonic series.
Solution. We only need to generate the terms as a vector, then take its sum.\n\n\( > > \mathrm{n} = \left\lbrack \begin{array}{lll} 1 & : & {1000} \end{array}\right\rbrack \)\n\n\( > > \mathrm{a} = 1./\mathrm{n} \) ;\n\n\( > > \operatorname{sum}\left( \mathrm{a}\right) \)\n\nans \( = {7.4855} \)
Yes
Estimate \( {\int }_{0}^{\pi /2}{e}^{{x}^{2}}\cos \left( x\right) {dx} \) using Octave’s quad algorithm.
Solution. The correct syntax is quad(’ \( \mathrm{f} \) ’, a, b). We need to first define the function.\n\n\( > > \) function \( \mathrm{y} = \mathrm{f}\left( \mathrm{x}\right) \)\n\n\( \mathrm{y} = \exp \left( {\mathrm{x} \cdot {}^{ \land }2}\right) \cdot * \cos \left( \mathrm{x}\right) ; \)\n\nend\n\n\( > > \operatorname{quad}\left( {{}^{\prime }{\mathrm{f}}^{\prime },0,\mathrm{{pi}}/2}\right) \)\n\nans \( = {1.8757} \)
Yes
Write an Octave script to calculate a midpoint rule approximation of\n\n\\[ \n{\\int }_{0}^{\\pi /2}{e}^{{x}^{2}}\\cos \\left( x\\right) {dx} \n\\]\n\nusing \\( n = {100} \\) .
Solution. The basic strategy is to use a for loop that adds an additional function value to a running total with each iteration. Then the final answer is found by multiplying the sum by \\( {\\Delta x} \\) .\n\nThe following code can be used. Switch to the editor tab and enter the code in a plain text file. Save it as midpoint.m. It must be placed in your working directory, then it can be run by typing midpoint at the command prompt, or by clicking the \
No
Write a vectorized Octave script to calculate a midpoint rule approximation of\n\n\\[ \n{\\int }_{0}^{\\pi /2}{e}^{{x}^{2}}\\cos \\left( x\\right) {dx} \n\\]\n\nusing \\( n = {100} \\) .
Solution. Now our strategy is to create a vector of the \\( x \\) -coordinates of the midpoints. Then we evaluate \\( f \\) over this midpoint vector to obtain a vector of function values. The midpoint approximation is the sum of the components of the vector, multiplied by \\( {\\Delta x} \\) .\n\n---\n\nOctave Script 3.2: Midpoint rule approximation - vectorized\n\n% file 'midpoint2.m'\n\n\\( {}_{2}\\% \\) calculates a midpoint rule approximation of\n\n\\( {}_{3}\\% \\) the integral from 0 to \\( \\mathrm{{pi}}/2 \\) of \\( \\mathrm{f}\\left( \\mathrm{x}\\right) = \\exp \\left( {{\\mathrm{x}}^{ \\land }2}\\right) \\cos \\left( \\mathrm{x}\\right) \\)\n\n\\( 4\\% \\) -vectorized code\n\n\\( {}_{6}\\% \\) set limits of integration, number of terms and delta \\( \\mathrm{x} \\)\n\n\\( 7\\mathrm{a} = 0 \\)\n\n\\( {sb} = \\mathrm{{pi}}/2 \\)\n\n9 n \\( = {100} \\)\n\n\\( {dx} = \\left( {b - a}\\right) /n \\)\n\n\\( {}_{2}\\% \\) define function to integrate\n\n3 function \\( \\mathrm{y} = \\mathrm{f}\\left( \\mathrm{x}\\right) \\)\n\n\\( \\mathrm{y} = \\exp \\left( {\\mathrm{x} \\cdot \\widehat{}2}\\right) \\cdot * \\cos \\left( \\mathrm{x}\\right) ; \\)\n\nend\n\n\\( 7\\% \\) create vector of midpoints\n\n\\( {18}\\mathrm{\\;m} = \\left\\lbrack {\\mathrm{a} + \\mathrm{{dx}}/2 : \\mathrm{{dx}} : \\mathrm{b} - \\mathrm{{dx}}/2}\\right\\rbrack \\) ;\n\n\\( {10}\\% \\) create vector of function values at midpoints\n\n\\( \\mathrm{M} = \\mathrm{f}\\left( \\mathrm{m}\\right) \\) ;\n\n\\( {}_{23}\\% \\) midpoint approximation to the integral\n\n24 approx \\( = \\mathrm{{dx}} * \\operatorname{sum}\\left( \\mathrm{M}\\right) \\)
Yes
Example 3.3.1. Graph three periods of a radius 2 cycloid.
Solution. The functions have period \( {2\pi } \), so we need \( 0 \leq t \leq {6\pi } \) to see three full cycles. We need to define the parameter \( t \) as a vector over this range, then we calculate \( x \) and \( y \), and plot \( x \) vs. \( y \) .\n\n\( > > \mathrm{t} = \) linspace \( \left( {0,6 * \mathrm{{pi}},{50}}\right) \) ;\n\n\( > > \mathrm{x} = 2 * \left( {\mathrm{t} - \sin \left( \mathrm{t}\right) }\right) \) ;\n\n\( > > \mathrm{y} = 2 * \left( {1 - \cos \left( \mathrm{t}\right) }\right) \) ;\n\n\( \gg \operatorname{plot}\left( {\mathrm{x},\mathrm{y}}\right) \)\n\n\( > > \) axis \( \left( {{}^{\prime }\text{equal ’}}\right) \)\n\n\( > > \operatorname{axis}\left( \left\lbrack \begin{array}{llll} 0 & {12} * \mathrm{{pi}} & 0 & 4 \end{array}\right\rbrack \right) \)\n\nThe command axis(’equal’) is used to force an equal aspect ratio between the \( x \) - and \( y \) -axes. The result is shown in Figure 3.2. To see a simple animation of this plot, try comet(x, y).
Yes
Plot the limaçon \( r = 1 - 2\sin \left( \theta \right) \) .
The needed commands are shown below and the graph is shown in Figure 3.3.\n\n\( > > \) theta \( = \) linspace \( \left( {0,2 * \mathrm{{pi}},{100}}\right) \) ;\n\n\( > > \mathrm{r} = 1 - 2 * \sin \left( \text{theta}\right) \) ;\n\n\( > > \mathrm{x} = \mathrm{r} \cdot * \cos \left( \text{theta}\right) \) ;\n\n\( > > \mathrm{y} = \mathrm{r} \cdot * \sin \left( \text{theta}\right) \) ;\n\n\( \gg \operatorname{plot}\left( {\mathrm{x},\mathrm{y}}\right) \)
Yes
Plot the curve defined by the equation\n\n\[ - {x}^{2} - {xy} + x + {y}^{2} - y = 1 \]
Solution. To define the function as \( f\left( {x, y}\right) = 0 \), we subtract 1 from both sides of the equation.\n\n\( > > \mathrm{f} = @\left( {\mathrm{x},\mathrm{y}}\right) - \mathrm{x} \cdot {}^{\hat{} }2 - \mathrm{x} \cdot * \mathrm{y} + \mathrm{x} + \mathrm{y} \cdot {}^{\hat{} }2 - \mathrm{y} - 1 \)\n\n\( \mathrm{f} = \)\n\n\[ @\left( {\mathrm{x},\mathrm{y}}\right) - \mathrm{x}\text{. }2 - \mathrm{x} \cdot * \mathrm{y} + \mathrm{x} + \mathrm{y} \cdot \uparrow 2 - \mathrm{y} - 1 \]\n\n\( \gg \operatorname{ezplot}\left( \mathrm{f}\right) \)\n\nRun the ezplot command to see the results. Do you recognize the curve (see Figure 3.5)?
No
Find the equation of the line tangent to the graph of the circle \( {\left( x - 2\right) }^{2} + {y}^{2} = {25} \) , at the point \( \left( {-1,4}\right) \) . Plot a graph of the circle and the tangent line on the same axes.
Solution. To plot the circle, we’ll first define it as a function of the form \( f\left( {x, y}\right) = 0 \) .\n\n\[ > > \mathrm{f} = @\left( {\mathrm{x},\mathrm{y}}\right) \left( {\mathrm{x} - 2}\right) \cdot {}^{ \land }2 + \mathrm{y} \cdot {}^{ \land }2 - {25}\text{;} \]\n\nThe center of the circle is at \( \left( {2,0}\right) \) and the radius is 5 . We will set the axes of our plot to extend a few units beyond the circumference of the circle.\n\n\( > > \% \) implicit plot of \( \mathrm{f}\left( {\mathrm{x},\mathrm{y}}\right) = 0 \) over domain \( \left\lbrack {-6,{10}}\right\rbrack \mathrm{x}\left\lbrack {-8,8}\right\rbrack \)\n\n\( > > \operatorname{ezplot}\left( {f,\left\lbrack \begin{array}{llll} - 6 & {10} & - 8 & 8 \end{array}\right\rbrack }\right) \)\n\nUsing implicit differentiation, the derivative is \( {y}^{\prime } = \frac{2 - x}{y} \) . At the point \( \left( {-1,4}\right) \), the slope is thus \( 3/4 \) . The equation of the tangent line is\n\n\[ y = \frac{3}{4}x + \frac{19}{4} \]\n\nNow, add the tangent line to the graph.\n\n\( > > \mathrm{x} = \left\lbrack \begin{array}{lll} - 6 & : & {10} \end{array}\right\rbrack \)\n\n\( > > \mathrm{y} = 3/4 * \mathrm{x} + {19}/4 \) ;\n\n\( > > \) hold on\n\n\( \gg \operatorname{plot}\left( {\mathrm{x},\mathrm{y},{}^{\prime }\mathrm{r} - {}^{\prime }}\right) \)\n\nThe result is shown in Figure 3.6.
Yes
Example 3.4.1. Let \( f\left( x\right) = {x}^{3} + 3{x}^{2} - {10x} \) .\n\n(a) Evaluate \( f\left( \frac{1}{2}\right) \) .
Solution. The first step is to declare \( x \) as a symbolic variable with the command syms.\n\nsyms \( \mathrm{x} \) \( \% \) declare symbolic variable \( \mathrm{x} \)\n\nNow we define the expression. Notice that we do not need to worry about using elementwise operations here.\n\n\( \gg \mathrm{f} = {\mathrm{x}}^{ * }3 + 3 * {\mathrm{x}}^{ * }2 - {10} * \mathrm{x}\;\% \) define \( \mathrm{f} \) as a symbolic expression\n\n\[ \mathrm{f} = \left( \mathrm{{sym}}\right) \]\n\n\[ \begin{array}{rr} 3 & 2 \\ \mathrm{x} + 3 * \mathrm{x} & - {10} * \mathrm{x} \end{array} \]\n\nThe command to evaluate a symbolic expression is subs \( \left( {f, x}\right) \) . In Octave, \( 1/2 \) evaluates to a decimal, hence a warning that floating-point values should not be passed to symbolic functions is raised if we enter subs \( \left( {\mathrm{f},1/2}\right) \) :\n\n\( \gg \operatorname{subs}\left( {\mathrm{f},1/2}\right) \)\n\nwarning: passing floating-point values to sym is dangerous, see 'help sym'\n\nwarning: called from\n\ndouble_to_sym_heuristic at line 50 column 7\n\nsym at line 379 column 13\n\nsubs at line 178 column 9\n\nTo avoid this, we can enter \( 1/2 \) as a symbolic variable by using \( \operatorname{sym}\left( 1\right) /2 \), which keeps the fraction as an exact symbolic expression.\n\n\( > > \operatorname{subs}\left( {f,\operatorname{sym}\left( 1\right) /2}\right) \)\n\nans \( = \left( \mathrm{{sym}}\right) - {33}/8 \)
Yes
Let \( f\left( x\right) = {x}^{2}\sin x \) . Find each of the following:\n\n(a) \( {f}^{\prime }\left( x\right) \)\n\n(b) \( \int f\left( x\right) {dx} \)\n\n(c) \( {\int }_{0}^{\pi /4}f\left( x\right) {dx} \)
Solution. First we define the expression.\n\n\( > > \mathrm{f} = \mathrm{x}{}^{ \land }2 * \sin \left( \mathrm{x}\right) \)\n\n\( \mathrm{f} = \left( \mathrm{{sym}}\right) \)\n\n\[ \begin{matrix} 2 \\ \mathrm{x} * \sin \left( \mathrm{x}\right) \end{matrix} \]\n\nNow, calculate the derivative using the diff command.\n\n\[ > > \operatorname{diff}\left( {f, x}\right) \]\n\n\[ \text{ans} = \left( \mathrm{{sym}}\right) \]\n\n\[ \mathrm{x} * \cos \left( \mathrm{x}\right) + 2 * \mathrm{x} * \sin \left( \mathrm{x}\right) \]\n\nNext, calculate the integrals using int.\n\n\[ \gg \operatorname{int}\left( {f, x}\right) \]\n\nans \( = \left( \mathrm{{sym}}\right) \]\n\n\[ - x * \cos \left( x\right) + 2 * x * \sin \left( x\right) + 2 * \cos \left( x\right) \]\n\n\( > > \operatorname{int}\left( {f, x,0,\operatorname{sym}\left( {pi}\right) /4}\right) \)\n\nans \( = \left( \mathrm{{sym}}\right) \]\n\n\[ - 2 - \frac{\smallsetminus /2 \times {\mathrm{{pi}}}^{2}}{32} + \frac{\smallsetminus /2 \times \mathrm{{pi}}}{4} + \smallsetminus /2 \]\n\nIf you want to see the answer as a decimal approximation, type double(ans): \( \gg \) double (ans) ans \( = {0.088755} \)
Yes
Show that\n\n\[ \n{\int }_{-r}^{r}2\sqrt{{r}^{2} - {x}^{2}}{dx} = \pi {r}^{2} \n\]
Solution. The integral, of course, represents the area of circle of radius \( r \) .\n\n\( > > \) syms \( \mathrm{x}\mathrm{r} \)\n\n\( > > \mathrm{f} = 2 * \operatorname{sqrt}\left( {\mathrm{r}\widehat{}2 - \mathrm{x}\widehat{}2}\right) \)\n\n\( \mathrm{f} = \left( \mathrm{{sym}}\right) \) ![c6a99c62-f1ae-42a9-87a0-435f643c2ede_66_0.jpg](images/c6a99c62-f1ae-42a9-87a0-435f643c2ede_66_0.jpg)\n\n\[ \n\gg \operatorname{int}\left( {f, - r, r}\right) \n\]\n\nIf you run these commands as shown, you will get a rather complicated and unexpected answer. The problem is that we have implicitly assumed \( r > 0 \), but Octave does not know this. We can fix the problem by setting an assumption on \( r \) .\n\n\( > > \) assume \( \left( {r,{}^{\prime }\text{positive ’}}\right) \)\n\n\( > > \operatorname{int}\left( {f, - r, r}\right) \)\n\nans \( = \left( \mathrm{{sym}}\right) \)\n\n2\n\n\[ \n\text{pi* r} \n\]\n\nNow the result is as expected. Various other assumptions on symbolic variables are also possible (e.g., integer, nonzero, real, etc.).
Yes
Example 3.4.4. Let \( f\left( x\right) = {x}^{3} + 3{x}^{2} - {10x} \) . Graph \( f,{f}^{\prime } \), and \( {f}^{\prime \prime } \) on the same axes.
Solution. Once we’ve defined \( f \), plotting the function is as simple as typing explot \( \left( \mathrm{f}\right) \) .\n\n\( > > \) syms \( \mathrm{x} \)\n\n\( > > \mathrm{f} = {\mathrm{x}}^{ \land }3 + 3 * {\mathrm{x}}^{ \land }2 - {10} * \mathrm{x} \)\n\n\( \mathrm{f} = \left( \mathrm{{sym}}\right) \)\n\n\[ 3 + 3 * x - {10} * x \]\n\n\( > > \) ezplot \( \left( \mathrm{f}\right) \)\n\nThe default plot is over \( \left\lbrack {-{2\pi },{2\pi }}\right\rbrack \) . If we want to see the function over a wider range, we can use ezplot \( \left( {\mathrm{f},\left\lbrack {\mathrm{a}\mathrm{b}}\right\rbrack }\right) \) to set the domain. In this case, the default domain covers the region of interest, but it will be helpful to adjust the viewpoint using the axis function. We would also like to change the line width. To do that, we will name the plot, then use that handle as a\n\n![c6a99c62-f1ae-42a9-87a0-435f643c2ede_67_0.jpg](images/c6a99c62-f1ae-42a9-87a0-435f643c2ede_67_0.jpg)\n\nFigure 3.7: Graph of a polynomial and its derivatives\n\nreference to the set function. Similar syntax can be used to adjust line width, color, and line style options.\n\n\( \gg \mathrm{h} = \operatorname{ezplot}\left( \mathrm{f}\right) \) ;\n\n\( > > \) set \( \left( {\mathrm{h},\text{ ’linewidth’,}2}\right) \) ;\n\nNow we just need to add the graphs of the first two derivatives.\n\n\( > > \) hold on\n\n\( > > \operatorname{ezplot}\left( {\operatorname{diff}\left( {f, x}\right) }\right) \)\n\n\( > > \operatorname{ezplot}\left( {\operatorname{diff}\left( {f, x,2}\right) }\right) \)\n\n\( > > \operatorname{axis}\left( \left\lbrack \begin{array}{llll} - 6 & 5 & - {20} & {40} \end{array}\right\rbrack \right) \)\n\n\( > > \) grid on\n\n>> xlabel('x')\n\n\( \gg \) ylabel \( \left( {{}^{\prime }{\mathrm{y}}^{\prime }}\right) \)\n\n\( > > \) title('') % remove default ezplot title\n\n\( \gg \) legend('function','first derivative','second derivative')\n\n\( > > \) legend('location','southeast') %move legend to lower right\n\nTo more clearly show the relationship between these curves, it will be helpful to make the coordinate axes explicitly visible. We can use the method described in Chapter 1 Exercise 6.\n\n\( > > \operatorname{plot}\left( {\left\lbrack \begin{array}{ll} - 6 & 5 \end{array}\right\rbrack ,\left\lbrack \begin{array}{ll} 0 & 0 \end{array}\right\rbrack ,{}^{\prime }{\mathrm{k}}^{\prime },\left\lbrack \begin{array}{ll} 0 & 0 \end{array}\right\rbrack ,\left\lbrack \begin{array}{ll} - {20} & {40} \end{array}\right\rbrack ,{}^{\prime }{\mathrm{k}}^{\prime }}\right) \)\n\n\( > > \) axis off\n\nThe graph is shown in Figure 3.7.
Yes
Let \( {z}_{1} = 1 + {2i} \) and \( {z}_{2} = 2 - {3i} \) . Find each of the following:\n\n\[ \n{z}_{1} + {z}_{2},{z}_{2} - {z}_{1},{z}_{1} \cdot {z}_{2}\\text{, and}{z}_{1}/{z}_{2} \n\]
Solution. Octave has no difficulty dealing with complex arithmetic. The variables \( i \) and \( j \) \n\n(not case-sensitive) are both by default recognized as the imaginary unit \( \\sqrt{-1} \) . \n\nFirst define the variables: \n\n\[ \n> > \\mathrm{z}1 = 1 + 2\\mathrm{i} \n\] \n\n\[ \n> > \\mathrm{z}2 = 2 - 3\\mathrm{i} \n\] \n\nNow carry out the indicated operations: \n\n\[ \n> > \\mathrm{z}1 + \\mathrm{z}2 \n\] \n\n\[ \n\\text{ans} = 3 - 1\\mathrm{i} \n\] \n\n\[ \n> > \\mathrm{z}2 - \\mathrm{z}1 \n\] \n\n\[ \n\\text{ans} = 1 - 5\\mathrm{i} \n\] \n\n\n\[ \n> > \\mathrm{z}1 * \\mathrm{z}2 \n\] \n\nans \( = 8 + 1\\mathrm{i} \n\n\[ \n> > \\mathrm{z}1/\\mathrm{z}2 \n\] \n\n\[ \n\\text{ans} = - {0.30769} + {0.53846}\\mathrm{i} \n\] \n\nEach result is expressed in the standard \( a + {bi} \) format. The commands \( \\operatorname{real}\\left( \\mathrm{z}\\right) \) and \( \\operatorname{imag}\\left( \\mathrm{z}\\right) \) can be used to extract the real part \( a \) and complex part \( b \), if needed.
Yes
Let \( {z}_{1} = 1 + {2i} \) and \( {z}_{2} = 2 - {3i} \) . Plot \( {z}_{1},{z}_{2} \), and the sum \( {z}_{1} + {z}_{2} \) in the complex plane.
Solution. We will show both variables and their sum on one set of axes.\n\n\( > > \mathrm{z}1 = 1 + 2\mathrm{i} \)\n\n\( > > \mathrm{z}2 = 2 - 3\mathrm{i} \) ;\n\n\( > > \operatorname{compass}\left( {\mathrm{z}1,{}^{\prime }{\mathrm{b}}^{\prime }}\right) \)\n\n\( > > \) hold on\n\n\( > > \operatorname{compass}\left( {\mathrm{z}2,{}^{\prime }{\mathrm{r}}^{\prime }}\right) \)\n\n\( > > \operatorname{compass}\left( {\mathrm{z}1 + \mathrm{z}2,{}^{\prime }\mathrm{k} - {}^{\prime }}\right) \)\n\n\( > > \operatorname{legend}\left( {\left| {z}_{ - }\right| {}^{\prime },{}^{\prime }{z}_{ - }2{}^{\prime },{}^{\prime }{z}_{ - }1 + {z}_{ - }2{}^{\prime }}\right) \)\n\nThe plot is shown in Figure 4.1. The horizontal axis is real and the vertical axis is imaginary.
Yes
Example 4.2.1. Graph \( \Gamma \left( {x + 1}\right) \) together on the same set of axes with the factorial function \( x \) !, for corresponding nonnegative integer values of \( x \) .
Solution. Both the gamma function and factorial function grow quite large very quickly, so we need to take care in selecting the domain. The gamma function is defined for positive and negative real numbers, while the factorial function is of course defined only for nonnegative integers. We will try the graph for \( x \geq - 5 \) for the gamma function and \( n = 0,1,2,3,4 \) for the factorial.\n\nTrial and error shows that a fine increment is needed for a smooth graph of the gamma function.\n\n![c6a99c62-f1ae-42a9-87a0-435f643c2ede_74_0.jpg](images/c6a99c62-f1ae-42a9-87a0-435f643c2ede_74_0.jpg)\n\nFigure 4.2: Improved graph of gamma function and factorial function\n\nThese are the basic commands needed:\n\n\( > > \mathrm{n} = \left\lbrack \begin{array}{lll} 0 & : & 4 \end{array}\right\rbrack \) ;\n\n\( > > \mathrm{x} = \operatorname{linspace}\left( {-5,5,{500}}\right) \) ;\n\n\( \gg \operatorname{plot}\left( {\mathrm{n},\operatorname{factorial}\left( \mathrm{n}\right) ,{}^{\prime } * {}^{\prime },\mathrm{x},\operatorname{gamma}\left( {\mathrm{x} + 1}\right) }\right) \)\n\n\( > > \operatorname{axis}\left( \left\lbrack \begin{array}{llll} - 5 & 5 & - {10} & {30} \end{array}\right\rbrack \right) \) ;\n\n\( > > \) grid on;\n\n\( \gg \operatorname{legend}\left( {{}^{\prime }\mathrm{n}!{}^{\prime },{}^{\prime }\operatorname{gamma}{\left( \mathrm{n} + 1\right) }^{\prime },{}^{\prime }\operatorname{location}{}^{\prime },{}^{\prime }\text{southeast }{}^{\prime }}\right) \)\n\nNotice the vertical asymptotes at each negative integer. If you run the plot commands as shown above, you will see vertical line segments that are not a true part of the graph. If we don't want to see these, we can divide the domain into separate intervals with breaks at the discontinuities. This is somewhat tedious, but produces a more accurate graph, as shown in Figure 4.2.\n\nDefine the \( x \) -values as follows:\n\n\[ \mathrm{x}1 = \operatorname{linspace}\left( {-5, - 4,{200}}\right) \text{;} \]\n\n\[ \mathrm{x}2 = \operatorname{linspace}\left( {-4, - 3,{200}}\right) \text{;} \]\n\n\[ \mathrm{x}3 = \operatorname{linspace}\left( {-3, - 2,{200}}\right) \text{;} \]\n\n\[ \mathrm{x}4 = \operatorname{linspace}\left( {-2, - 1,{200}}\right) \text{;} \]\n\n\[ \mathrm{x}5 = \operatorname{linspace}\left( {-1,5,{200}}\right) \text{;} \]\n\nThen, plot \( {x}_{1} \) vs. \( \Gamma \left( {{x}_{1} + 1}\right) ,{x}_{2} \) vs. \( \Gamma \left( {{x}_{2} + 1}\right) \), etc., on the same set of axes.
Yes
Create a vector \( Z \) of 1000 elements from the standard normal distribution. Use the transformation \( X = {Z\sigma } + \mu \) to generate a vector \( X \) of elements from a normal distribution with mean 400 and standard deviation 50 . Compare the means and variances of \( X \) and \( Z \) . Plot histograms of \( Z \) and \( X \) .
Solution. Here are the commands we need:\n\n\( \gg \% \) sample 1000 elements from a standard normal distribution\n\n\( > > \mathrm{Z} = \operatorname{randn}\left( {{1000},1}\right) \) ;\n\n\( > > \% \) transform the mean and standard deviation\n\n\( > > \mathrm{{mu}} = {400};\operatorname{sigma} = {50} \) ;\n\n\( > > \mathrm{X} = \mathrm{Z} * \operatorname{sigma} + \mathrm{{mu}} \) ;\n\n\( > > \% \) review resulting sample mean and variance\n\n\( > > \) format free;\n\n\( \gg \operatorname{mean}\left( \left\lbrack {\mathrm{Z}\mathrm{X}}\right\rbrack \right) \)\n\nans \( = \)\n\n-0.00116119 399.942\n\n\( > > \operatorname{var}\left( \left\lbrack {\mathrm{Z}\mathrm{X}}\right\rbrack \right) \)\n\nans \( = \)\n\n1.04291 2607.28\n\n\( > > \% \) plot histograms\n\n\( > > \) hist \( \left( \mathrm{Z}\right) \)\n\n\( \gg \) hist \( \left( \mathrm{X}\right) \)\n\nThe command format free changes from the default short form scientific notation. We can see \( Z \) has mean and variance near 0 and 1, respectively, while \( X \) has a mean near 400 and variance near 2500 , as expected. The histograms are identical, except for the scale on the horizontal axis (see, for example, Figure 4.5).
Yes
Example 4.3.2. Let \( x = \{ 5,9,{18},{25},{32},{40},{53}\} \) and \( y = \{ {32},{28},{23},{20},{19},{18},9\} \) . Create a scatter plot of the data and calculate the correlation coefficient. Find the equation of the regression line and add it to the scatter plot.
Solution. First we enter the data and create the scatter plot.\n\n\( > > \mathrm{x} = \left\lbrack \begin{array}{lllllll} 5 & 9 & {18} & {25} & {32} & {40} & {53} \end{array}\right\rbrack \) ;\n\n\( > > \mathrm{y} = \left\lbrack \begin{array}{lllllll} {32} & {28} & {23} & {20} & {19} & {18} & 9 \end{array}\right\rbrack \) ;\n\n\( \gg \operatorname{plot}\left( {\mathrm{x},\mathrm{y},{}^{\prime }{\mathrm{o}}^{\prime }}\right) \) ;\n\nNow, calculate the regression line and correlation coefficient.\n\n\\[\n> > \mathrm{P} = \text{ polyfit }\left( {\mathrm{x},\mathrm{y},1}\right)\n\\]\n\n\\[\n\mathrm{P} =\n\\]\n\n\\[\n- {0.42312}\;{32.28685}\n\\]\n\n\\[\n> > \mathrm{r} = \operatorname{corr}\left( {\mathrm{x},\mathrm{y}}\right)\n\\]\n\n\\[\n\mathrm{r} = - {0.97394}\n\\]\n\nThe \( r \) -value suggests a strong negative linear correlation.\n\nThe equation of the regression line is \( \widehat{y} = - {0.42312x} + {32.28685} \) . We can add this to the plot using the polyval function to evaluate our regression equation at each \( x \) -value.\n\n\( > > \) hold on;\n\n\( > > \) y_hat \( = \) polyval \( \left( {\mathrm{P},\mathrm{x}}\right) \) ;\n\n\( > > \) plot \( \left( {\mathrm{x},\mathrm{y}\text{_hat}}\right) \)\n\nThe scatter plot and regression line are shown in Figure 4.6.
Yes
Example 4.3.3. Plot binomial distributions for \( n = {10},{25} \), and 50 trials with probability of success \( p = {0.8} \) . What happens to the shape of the distribution as \( n \) increases?
Solution. The function binopdf \( \left( {\mathrm{x},\mathrm{n},\mathrm{p}}\right) \) gives the probability of \( x \) successes in \( n \) trials of a binomial experiment with a probability of success \( p \) on each trial. Load the statistics package to access this function. The distributions can be plotted with the command bar(x, B), where \( x \) is the vector of possible outcomes and \( B \) is the corresponding vector of binomial probabilities.\n\nFirst we generate a plot with \( n = {10} \).\n\n\( > > \) pkg load statistics\n\n\( > > \mathrm{n} = {10};\mathrm{p} = {0.8};\mathrm{x} = \left\lbrack \begin{array}{ll} 0 & : \mathrm{n} \end{array}\right\rbrack \) ;\n\n\( > > \mathrm{B} = \operatorname{binopdf}\left( {\mathrm{x},\mathrm{n},\mathrm{p}}\right) \) ;\n\n\( > > \operatorname{bar}\left( {\mathrm{x},\mathrm{B}}\right) \) ;\n\nThe graph is shown in Figure 4.7. Repeat the above steps for \( n = {25} \) and \( n = {50} \) . You should see distributions whose shapes become progressively more normal.
No
For our random walk example, find the probability vector after five steps for each of these initial probability vectors:
Solution. We first form an array that records the probability of moving between positions.\n\n<table><thead><tr><th colspan=\
No
Find an equilibrium vector for the Markov chain with transition matrix\n\n\[ T = \left\lbrack \begin{array}{lll} {0.48} & {0.51} & {0.14} \\ {0.29} & {0.04} & {0.52} \\ {0.23} & {0.45} & {0.34} \end{array}\right\rbrack \]
Solution.\n\n\[ \begin{array}{l} > > \mathrm{T} = \left\lbrack \begin{array}{lllllllll} {0.48} & {0.51} & {0.14}; & {0.29} & {0.04} & {0.52}; & {0.23} & {0.45} & {0.34} \end{array}\right\rbrack \\ \mathrm{T} = \end{array} \]\n\n\[ \begin{array}{lll} {0.480000} & {0.510000} & {0.140000} \end{array} \]\n\n\[ \text{0.290000 0.040000 0.520000} \]\n\n0.230000 0.450000 0.340000\n\n\[ > > \left\lbrack {\mathrm{v}\text{ lambda }}\right\rbrack = \operatorname{eig}\left( \mathrm{T}\right) \]\n\n\( \mathrm{v} = \)\n\n\[ \begin{array}{lll} - {0.64840} & - {0.80111} & {0.43249} \end{array} \]\n\n\[ \begin{array}{lll} - {0.50463} & {0.26394} & - {0.81601} \end{array} \]\n\n\[ \begin{array}{lll} - {0.57002} & {0.53717} & {0.38351} \end{array} \]\n\nlambda \( = \)\n\nDiagonal Matrix\n\n\( \begin{array}{ll} 0 & - {0.35810} \end{array} \)\n\n\( > > \mathrm{x} = \mathrm{v}\left( { : ,1}\right) /\operatorname{sum}\left( {\mathrm{v}\left( { : ,1}\right) }\right) \)\n\n\( \mathrm{x} = \)\n\n0.37631\n\n0.29287\n\n0.33082\n\nThus \( \mathbf{x} = \langle {0.37631},{0.29287},{0.33082}\rangle \) is an equilibrium vector. Let’s test it.\n\n\( > > {\mathrm{T}}^{ \land }{10} * \mathrm{x} \)\n\nans \( = \)\n\n0.37631\n\n0.29287\n\n0.33082\n\n\( > > {\mathrm{T}}^{ \land }{50} * \mathrm{x} \)\n\nans \( = \)\n\n0.37631\n\n0.29287\n\n0.33082\n\nThere is no change evident, so it seems to work!
Yes
Theorem 5.3.2. If \( A \) is an \( n \times n \) diagonalizable matrix and \( A = {S\Lambda }{S}^{-1} \) and \( k \) is a positive integer, then
\[ {A}^{k} = S{\Lambda }^{k}{S}^{-1} = S\left\lbrack \begin{array}{llll} {\lambda }_{1}^{k} & & & \\ & {\lambda }_{2}^{k} & & \\ & & \ddots & \\ & & & {\lambda }_{n}^{k} \end{array}\right\rbrack {S}^{-1} \]
Yes
Example 5.3.3. Let \( A = \left\lbrack \begin{array}{rr} 7 & 8 \\ - 4 & - 5 \end{array}\right\rbrack \) . Find \( {A}^{100} \) .
Solution. Octave can solve such a problem easily.\n\n\[ \n> > \mathrm{A} = \left\lbrack \begin{array}{lll} 7 & 8 & \\ 5 & - 4 & - 5 \end{array}\right\rbrack \n\] \n\n\( \mathrm{A} = \)\n\n7\n\n\( - 4\; - 5 \)\n\n>> A^100\n\nans \( = \)\n\n\[ \n{1.0308}\mathrm{e} + {048}\;{1.0308}\mathrm{e} + {048} \]\n\n\[ \n- {5.1538}\mathrm{e} + {047}\; - {5.1538}\mathrm{e} + {047} \]\n\n\nBut how does Octave do this? Not by brute force, but by using Theorem 5.3.2. Here's how. First we need to calculate the eigenvalues and associated eigenvectors. Verify that the eigenvalues and eigenvectors are\n\n\[ \n{\lambda }_{1} = 3,{\mathbf{v}}_{1} = \left\lbrack \begin{array}{r} - 2 \\ 1 \end{array}\right\rbrack \]\n\n\[ \n{\lambda }_{2} = - 1,{\mathbf{v}}_{2} = \left\lbrack \begin{array}{r} - 1 \\ 1 \end{array}\right\rbrack \]\n\nThen \( \Lambda = \left\lbrack \begin{array}{rr} 3 & 0 \\ 0 & - 1 \end{array}\right\rbrack \). We form the matrix \( S \) using the eigenvectors:\n\n\[ \nS = \left\lbrack \begin{array}{rr} - 2 & - 1 \\ 1 & 1 \end{array}\right\rbrack \]\n\nNow we need to calculate the inverse matrix. It is\n\n\[ \n{S}^{-1} = \left\lbrack \begin{array}{rr} - 1 & - 1 \\ 1 & 2 \end{array}\right\rbrack \]\n\nTherefore the diagonalized form is\n\n\[ \nA = {S\Lambda }{S}^{-1} \]\n\n\[ \n= \left\lbrack \begin{array}{rr} - 2 & - 1 \\ 1 & 1 \end{array}\right\rbrack \cdot \left\lbrack \begin{array}{rr} 3 & 0 \\ 0 & - 1 \end{array}\right\rbrack \cdot \left\lbrack \begin{array}{rr} - 1 & - 1 \\ 1 & 2 \end{array}\right\rbrack \]\n\nSo,\n\n\[ \n{A}^{100} = S{\Lambda }^{100}{S}^{-1} \]\n\n\[ \n= \left\lbrack \begin{matrix} - 2 & - 1 \\ 1 & 1 \end{matrix}\right\rbrack \cdot {\left\lbrack \begin{matrix} 3 & 0 \\ 0 & - 1 \end{matrix}\right\rbrack }^{100} \cdot \left\lbrack \begin{matrix} - 1 & - 1 \\ 1 & 2 \end{matrix}\right\rbrack \]\n\n\[ \n= \left\lbrack \begin{matrix} - 2 & - 1 \\ 1 & 1 \end{matrix}\right\rbrack \cdot \left\lbrack \begin{matrix} {3}^{100} & 0 \\ 0 & 1 \end{matrix}\right\rbrack \cdot \left\lbrack \begin{matrix} - 1 & - 1 \\ 1 & 2 \end{matrix}\right\rbrack \]\n\n\[ \n= \left\lbrack \begin{matrix} - 2 \cdot {3}^{100} & - 1 \\ {3}^{100} & 1 \end{matrix}\right\rbrack \cdot \left\lbrack \begin{matrix} - 1 & - 1 \\ 1 & 2 \end{matrix}\right\rbrack \]\n\n\[ \n= \left\lbrack \begin{matrix} 2 \cdot {3}^{100} - 1 & 2 \cdot {3}^{100} - 2 \\ - {3}^{100} + 1 & - {3}^{100} + 2 \end{matrix}\right\rbrack \]\n\nCompare to the earlier Octave result:\n\n\[ \n> > \left\lbrack {2 * 3{}^{ \land }{100} - 1\;2 * 3{}^{ \land }{100} - 2;\; - 3{}^{ \land }{100} + 1\; - 3{}^{ \land }{100} + 2}\right\rbrack \]\n\nans \( = \)\n\n\[ \n{1.0308}\mathrm{e} + {048}\;{1.0308}\mathrm{e} + {048} \]\n\n\[ \n- {5.1538}\mathrm{e} + {047}\; - {5.1538}\mathrm{e} + {047} \]\n\nThis example shows some of the computational power of diagonalization.
Yes
Find an orthogonal diagonalization for \( A = \left\lbrack \begin{array}{rr} 2 & - 1 \\ - 1 & 2 \end{array}\right\rbrack \) .
Solution. \( A \) has eigenvalues 3 and 1 . The eigenvectors are \( \left\lbrack \begin{array}{r} 1 \\ - 1 \end{array}\right\rbrack \) and \( \left\lbrack \begin{array}{l} 1 \\ 1 \end{array}\right\rbrack \) . Notice that these are orthogonal. They are normalized by dividing by their length (both have length \( \sqrt{2} \) ). Then \( A \) can be diagonalized as\n\n\[ A = {Q\Lambda }{Q}^{T} \]\n\n\[ = {\left\lbrack \begin{matrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{matrix}\right\rbrack \cdot \left\lbrack \begin{matrix} 3 & 0 \\ 0 & 1 \end{matrix}\right\rbrack \cdot \left\lbrack \begin{matrix} \frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{matrix}\right\rbrack } \]
Yes
Use Octave to orthogonally diagonalize \( A = \left\lbrack \begin{array}{rr} 3 & 3 \\ 3 & - 1 \end{array}\right\rbrack \) .
Solution. If an orthogonal diagonalization is possible, Octave will return the output of the eig(A) command in that format. This explains why Octave chooses normalized vectors that form an orthogonal set, when possible.\n\n\[ \begin{array}{l} > > \mathrm{A} = \left\lbrack \begin{array}{llll} 3 & 3; & 3 & - 1 \end{array}\right\rbrack \\ \mathrm{A} = \end{array} \]\n\n\[ \begin{array}{rr} 3 & 3 \\ 3 & - 1 \end{array} \]\n\n\[ \gg \left\lbrack {QL}\right\rbrack = \operatorname{eig}\left( A\right) \]\n\n\[ \mathrm{Q} = \]\n\n\[ {0.47186} - {0.88167} \]\n\n\[ - {0.88167} - {0.47186} \]\n\n\( \mathrm{L} = \)\n\nDiagonal Matrix\n\n\[ - {2.6056}\;0 \]\n\n\( \begin{array}{ll} 0 & {4.6056} \end{array} \)\n\n\( \gg \mathrm{Q} * \mathrm{\;L} * {\mathrm{Q}}^{\prime }\;\% \) check the factorization by multiplying\n\nans \( = \)\n\n3.00000 3.00000\n\n3.00000 -1.00000
Yes
Theorem 5.4.1. Let \( A \) be an \( m \times n \) matrix. The square roots of the nonzero eigenvalues of \( {A}^{T}A \) and \( A{A}^{T} \) (they are the same) are called the singular values of \( A \), denoted \( {\sigma }_{1},{\sigma }_{2},\ldots ,{\sigma }_{r} \). Then \( A \) can be factored as \[ A = {U\sum }{V}^{T} \] where the columns of \( U \) are eigenvectors of \( A{A}^{T} \), the columns of \( V \) are eigenvectors of \( {A}^{T}A \), and the \( r \) singular values of \( A \) are on the diagonal of \( \sum \). This factorization is called the singular value decomposition of \( A \).
- \( U \) is \( m \times m \) and orthogonal\n- \( V \) is \( n \times n \) and orthogonal\n- \( \sum \) is \( m \times n \) and diagonal of the special form \[ \sum = \left\lbrack \begin{matrix} {\sigma }_{1} & & & & \vdots \\ & {\sigma }_{2} & & & 0 \\ & & \ddots & & \vdots \\ & & & {\sigma }_{r} & \\ \cdots & 0 & \cdots & & 0 \end{matrix}\right\rbrack \]
Yes
Let \( A = \left\lbrack \begin{array}{rr} 4 & 4 \\ - 3 & 3 \end{array}\right\rbrack \) . Find the SVD via the simplified procedure outlined above, then compare to the results obtained using the Octave function svd.
Solution. We can readily verify that \( \operatorname{rank}\left( A\right) = 2 \), so the matrix should have two singular values.\n\n\[ \begin{array}{l} > > \mathrm{A} = \left\lbrack \begin{array}{llll} 4 & 4; & - 3 & 3 \end{array}\right\rbrack \\ \mathrm{A} = \end{array} \]\n\n\( \begin{array}{ll} 4 & 4 \end{array} \)\n\n\( - 3\;3 \)\n\n\[ > > \mathrm{{ATA}} = {\mathrm{A}}^{\prime } * \mathrm{\;A} \]\n\n\[ \text{ATA} = \]\n\n\[ \begin{array}{rr} {25} & 7 \\ 7 & {25} \end{array} \]\n\n\( > > \left\lbrack {\mathrm{v}\text{ lambda }}\right\rbrack = \operatorname{eig}\left( \mathrm{{ATA}}\right) \)\n\n\( \mathrm{v} = \)\n\n\( - {0.70711}\;{0.70711} \)\n\n0.70711 0.70711\n\nlambda \( = \)\n\nDiagonal Matrix \( \begin{array}{ll} {18} & 0 \end{array} \) 0 32\n\nNotice that the given eigenvectors are orthogonal unit vectors. However, the eigenvalues are\n\nnot in decreasing order. So, we need to switch the order of both eigenvectors and singular\n\nvalues (they must be in decreasing order) as we build \( V \) and \( \sum \) .\n\n\( > > \) Sigma \( = \operatorname{zeros}\left( {2,2}\right) \) ;\n\n\( > > \operatorname{Sigma}\left( {1,1}\right) = \operatorname{sqrt}\left( {\operatorname{lambda}\left( {2,2}\right) }\right) \)\n\nSigma \( = \)\n\n\( \begin{array}{ll} {5.65685} & {0.00000} \end{array} \)\n\n\( \begin{array}{ll} {0.00000} & {0.00000} \end{array} \)\n\n\( > > \operatorname{Sigma}\left( {2,2}\right) = \operatorname{sqrt}\left( {\operatorname{lambda}\left( {1,1}\right) }\right) \)\n\nSigma \( = \)\n\n5.65685 0.00000\n\n0.00000 4.24264\n\n\( > > \mathrm{V}\left( { : ,1}\right) = \mathrm{v}\left( { : ,2}\right) \)\n\n\( \mathrm{V} = \)\n\n0.70711\n\n0.70711\n\n\( > > \mathrm{V}\left( { : ,2}\right) = \mathrm{v}\left( { : ,1}\right) \)\n\n\( \mathrm{V} = \)\n\n\[ \begin{array}{rr} {0.70711} & - {0.70711} \\ {0.70711} & {0.70711} \end{array} \]\n\nNow we build \( U \) to complete the factorization.\n\n\[ \mathrm{U} = \]\n\n1.00000\n\n0.00000\n\n\[ > > \mathrm{U}\left( { : ,2}\right) = 1/\operatorname{Sigma}\left( {2,2}\right) * \mathrm{\;A} * \mathrm{\;V}\left( { : ,2}\right) \]\n\n\[ \mathrm{U} = \]\n\n\( \begin{array}{ll} {1.00000} & {0.00000} \end{array} \)\n\n\( \begin{array}{ll} {0.00000} & {1.00000} \end{array} \)\n\nNow, let’s verify that \( {U\sum }{V}^{T} = A \) .\n\n\( > > \mathrm{U} * \operatorname{Sigma} * {\mathrm{V}}^{\prime } \)\n\nans \( = \)\n\n4.0000 4.0000\n\n-3.0000 3.0000
Yes
Find a linear equation of the form \( y = {ax} + b \) to model this data.
Solution. The given points yield a system \( A\mathbf{p} = \mathbf{y} \), with\n\n\[ A = \left\lbrack \begin{array}{rr} 5 & 1 \\ {10} & 1 \\ {12} & 1 \\ {18} & 1 \\ {21} & 1 \end{array}\right\rbrack ,\mathbf{p} = \left\lbrack \begin{array}{l} a \\ b \end{array}\right\rbrack ,\text{ and }\mathbf{y} = \left\lbrack \begin{array}{l} {42} \\ {24} \\ {30} \\ {18} \\ {15} \end{array}\right\rbrack \]\n\nEnter \( \mathbf{x},\mathbf{y} \), and \( A \) in Octave. We need to find the SVD of \( A \) :\n\n\( \mathrm{U} = \)\n\n\[ \begin{array}{lllll} - {0.156839} & - {0.767088} & - {0.379243} & - {0.354748} & - {0.342501} \end{array} \]\n\n\[ \begin{array}{lllll} - {0.311700} & - {0.407114} & - {0.118019} & {0.444130} & {0.725204} \end{array} \]\n\n\[ \begin{matrix} - {0.373645} & - {0.263125} & & {0.877307} & - {0.107405} & - {0.099761} \end{matrix} \]\n\n\[ \begin{array}{lllll} - {0.559478} & {0.168843} & - {0.176557} & {0.585728} & - {0.533129} \end{array} \]\n\n\[ \begin{matrix} - {0.652394} & {0.384827} & - {0.203488} & - {0.567705} & {0.250187} \end{matrix} \]\n\n\( \mathrm{S} = \)\n\nDiagonal Matrix\n\n<table><tr><td>2.22136</td><td>0</td></tr><tr><td>0</td><td>0.88546</td></tr><tr><td>0</td><td>0</td></tr><tr><td>0</td><td>0</td></tr><tr><td>0</td><td>0</td></tr></table>\n\n\( \mathrm{V} = \)\n\n\[ - {0.997966}\;{0.063748} \]\n\n\[ - {0.063748}\; - {0.997966} \]\n\nNext, we construct \( {\sum }^{ + } \) by taking the transpose and reciprocal of \( \sum \) :\n\n\( \gg \mathrm{{Sp}} = {\left( 1./\mathrm{S}\right) }^{\top };\;\% \) note: division by 0 returns inf\n\n\( \gg \operatorname{Sp}\left( {\text{isinf}\left( \mathrm{{Sp}}\right) }\right) = 0\;\% \) set all the instances of inf to 0\n\n\( \mathrm{{Sp}} = \)\n\n\( \begin{array}{lllll} {0.03104} & {0.00000} & {0.00000} & {0.00000} & {0.00000} \end{array} \)\n\n\( \begin{array}{lllll} {0.00000} & {1.12936} & {0.00000} & {0.00000} & {0.00000} \end{array} \)\n\nNote the \
Yes
Theorem 5.5.1. The Gram-Schmidt Process\n\nLet \( \\left\\{ {{\\mathbf{u}}_{1},{\\mathbf{u}}_{2},\\ldots ,{\\mathbf{u}}_{n}}\\right\\} \) be a linearly independent set. Then the following procedure will produce an orthogonal set \( \\left\\{ {{\\mathbf{v}}_{1},{\\mathbf{v}}_{2},\\ldots ,{\\mathbf{v}}_{n}}\\right\\} \) with the same span.
\[ \n{\\mathbf{v}}_{1} = {\\mathbf{u}}_{1} \n\] \n\n\[ \n{\\mathbf{v}}_{2} = {\\mathbf{u}}_{2} - {\\operatorname{proj}}_{{\\mathbf{v}}_{1}}\\left( {\\mathbf{u}}_{2}\\right) \n\] \n\n\[ \n{\\mathbf{v}}_{3} = {\\mathbf{u}}_{3} - {\\operatorname{proj}}_{{\\mathbf{v}}_{1}}\\left( {\\mathbf{u}}_{3}\\right) - {\\operatorname{proj}}_{{\\mathbf{v}}_{2}}\\left( {\\mathbf{u}}_{3}\\right) \n\] \n\n\[ \n\\vdots \n\] \n\n\[ \n{\\mathbf{v}}_{n} = {\\mathbf{u}}_{n} - {\\operatorname{proj}}_{{\\mathbf{v}}_{1}}\\left( {\\mathbf{u}}_{n}\\right) - {\\operatorname{proj}}_{{\\mathbf{v}}_{2}}\\left( {\\mathbf{u}}_{n}\\right) - \\cdots - {\\operatorname{proj}}_{{\\mathbf{v}}_{n - 1}}\\left( {\\mathbf{u}}_{n}\\right) \n\] \n\nTo normalize, set \n\n\[ \n{\\mathbf{w}}_{i} = \\frac{{\\mathbf{v}}_{i}}{\\begin{Vmatrix}{\\mathbf{v}}_{i}\\end{Vmatrix}} \n\] \n\nThen the set \( \\left\\{ {{\\mathbf{w}}_{1},{\\mathbf{w}}_{2},\\ldots ,{\\mathbf{w}}_{n}}\\right\\} \) is an orthonormal set with the same span as \( \\left\\{ {{\\mathbf{u}}_{1},{\\mathbf{u}}_{2},\\ldots ,{\\mathbf{u}}_{n}}\\right\\} \) and \( \\left\\{ {{\\mathbf{v}}_{1},{\\mathbf{v}}_{2},\\ldots ,{\\mathbf{v}}_{n}}\\right\\} \)
Yes
Theorem 5.5.3. Let \( A \) be a nonsingular square matrix. Then there exists an orthogonal matrix \( Q \) and an upper triangular matrix \( R \) such that \( A = {QR} \) .
Here’s how to find \( Q \) and \( R \) .\n\n1. Apply the Gram-Schmidt process to the columns of \( A \) . Use the resulting orthonormal vectors as columns of \( Q \) .\n\n2. Let \( R = \left\lbrack \begin{matrix} {\mathbf{q}}_{1} \cdot {\mathbf{a}}_{1} & {\mathbf{q}}_{1} \cdot {\mathbf{a}}_{2} & {\mathbf{q}}_{1} \cdot {\mathbf{a}}_{3} & \cdots & {\mathbf{q}}_{1} \cdot {\mathbf{a}}_{n} \\ 0 & {\mathbf{q}}_{2} \cdot {\mathbf{a}}_{2} & {\mathbf{q}}_{2} \cdot {\mathbf{a}}_{3} & \cdots & {\mathbf{q}}_{2} \cdot {\mathbf{a}}_{n} \\ 0 & 0 & {\mathbf{q}}_{3} \cdot {\mathbf{a}}_{3} & \cdots & {\mathbf{q}}_{3} \cdot {\mathbf{a}}_{n} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & 0 & {\mathbf{q}}_{n} \cdot {\mathbf{a}}_{n} \end{matrix}\right\rbrack \), where \( {\mathbf{q}}_{i} \) is the \( i \) th column of \( Q \) and \( {\mathbf{a}}_{j} \) is the \( j \) th column of \( A \) .
Yes
Theorem 5.5.5. The \( {QR} \) ALGORITHM\n\nLet \( A \) be an \( n \times n \) matrix with \( n \) real eigenvalues.\n\nSet \( {A}_{1} = A \) .\n\nFor each \( k = 1,2,3,\ldots \) do the following:\n\n(i) Find the \( {QR} \) decomposition of \( {A}_{k},{A}_{k} = {Q}_{k}{R}_{k} \) .\n\n(ii) Set \( {A}_{k + 1} = {R}_{k}{Q}_{k} \) .\n\nRepeat steps (i) and (ii).
As \( k \) increases, the matrices \( {A}_{k} \) approach an upper triangular form with the eigenvalues of \( A \) on the diagonal.
Yes
Example 5.5.6. Apply three iterations of the \( {QR} \) algorithm to the matrix \( A = \left\lbrack \begin{array}{rrr} 5 & 7 & 0 \\ {10} & 8 & 0 \\ 5 & 6 & - 5 \end{array}\right\rbrack \) .
Solution. We will use the built-in \( {QR} \) -decomposition function, \( \left\lbrack {\mathrm{Q}\mathrm{R}}\right\rbrack = \mathrm{{qr}}\left( \mathrm{A}\right) \) .\n\n\( > > \mathrm{A}1 = \mathrm{A} \)\n\n\( \mathrm{A}1 = \)\n\n\[ \begin{array}{rrr} 5 & 7 & 0 \\ {10} & 8 & 0 \\ 5 & 6 & - 5 \end{array} \]\n\n\( > > \left\lbrack \begin{array}{ll} \mathrm{Q}1 & \mathrm{R}1 \end{array}\right\rbrack = \operatorname{qr}\left( {\mathrm{A}1}\right) \)\n\n\( > > \mathrm{A}2 = \mathrm{R}1 * \mathrm{Q}1 \)\n\n\( \mathrm{A}2 = \)\n\n\[ \begin{array}{lll} {13.8333} & - {1.4881} & {10.0378} \end{array} \]\n\n\[ - {1.6254}\; - {2.4371}\; - {2.0258} \]\n\n\[ \begin{array}{lll} {1.6823} & - {1.6176} & - {3.3962} \end{array} \]\n\n\( > > \left\lbrack {\mathrm{Q}2\mathrm{R}2}\right\rbrack = \operatorname{qr}\left( {\mathrm{A}2}\right) \);\n\n\( > > \mathrm{A}3 = \mathrm{R}2 * \mathrm{Q}2 \)\n\n\( \mathrm{A}3 = \)\n\n\[ \begin{array}{lll} {15.159187} & {4.145301} & - {6.805968} \end{array} \]\n\n\[ \begin{array}{lll} - {0.013431} & - {4.054621} & {1.168669} \end{array} \]\n\n\[ \begin{array}{lll} {0.430485} & {1.750645} & - {3.104566} \end{array} \]\n\n\( > > \left\lbrack {\mathrm{Q}3\mathrm{R}3}\right\rbrack = \operatorname{qr}\left( {\mathrm{A}3}\right) \);\n\n\( > > \mathrm{A}4 = \mathrm{R}3 * \mathrm{Q}3 \)\n\n\( \mathrm{A}4 = \)\n\n\[ \begin{array}{lll} {14.959822} & {6.640881} & {5.216123} \end{array} \]\n\n\[ \begin{array}{lll} {0.065351} & - {4.860028} & - {0.375929} \end{array} \]\n\n\[ \begin{array}{lll} {0.064287} & - {0.846029} & - {2.099794} \end{array} \]\n\nIt turns out that the correct eigenvalues of \( A \) are \( {15}, - 5 \), and -2 . These values are already evident on the diagonal after only three iterations.
Yes
Graph the surface \( f\left( {x, y}\right) = \left( {1 + {xy}}\right) \left( {x + y}\right) \) .
Solution. We begin using the same basic procedure outlined above, this time choosing to plot the function over \( \left\lbrack {-5,5}\right\rbrack \times \left\lbrack {-5,5}\right\rbrack \) . \n\n\( > > \% \) define the domain\n\n\( > > \mathrm{x} = \operatorname{linspace}\left( {-5,5,{30}}\right) \) ;\n\n\( > > \mathrm{y} = \operatorname{linspace}\left( {-5,5,{30}}\right) \) ;\n\n\( > > \left\lbrack {XY}\right\rbrack = \operatorname{meshgrid}\left( {x, y}\right) \) ;\n\n\( > > \% \) calculate the range\n\n\( > > \mathrm{Z} = \left( {1 + \mathrm{X} \cdot * \mathrm{Y}}\right) \cdot * \left( {\mathrm{X} + \mathrm{Y}}\right) \) ;\n\n\( > > \% \) plot the surface\n\n\( > > \operatorname{surf}\left( {\mathrm{X},\mathrm{Y},\mathrm{Z}}\right) \)\n\nThe graph as shown in Figure 6.5 appears unremarkable. However, an analysis of the partial derivatives shows the existence of two critical points, at \( \left( {1, - 1}\right) \) and \( \left( {-1,1}\right) \), each of which corresponds to a saddle point (the reader should verify this). To see these features clearly, we need to manually adjust the viewpoint.\n\n>> % manually set new axis limits\n\n\( > > \operatorname{axis}\left( \left\lbrack \begin{array}{llllll} - 5 & 5 & - 5 & 5 & - {10} & {10} \end{array}\right\rbrack \right) \)\n\nThe two saddle points are now apparent (Figure 6.6). Notice that the axis command takes a 6-element vector as its argument, of the form [Xmin Xmax Ymin Ymax Zmin Zmax].
Yes
Graph the surface \( f\left( {x, y}\right) = \sqrt{9 - {x}^{2} - {y}^{2}} \) .
Solution. The function corresponds to the upper half of a radius-3 sphere. If we naively attempt to plot the function over \( \left\lbrack {-3,3}\right\rbrack \times \left\lbrack {-3,3}\right\rbrack \), we will run into trouble:\n\n\( > > \mathrm{x} = \operatorname{linspace}\left( {-3,3,{30}}\right) \) ;\n\n\( > > \mathrm{y} = \mathrm{x} \)\n\n\( > > \left\lbrack {XY}\right\rbrack = \operatorname{meshgrid}\left( {x, y}\right) \) ;\n\n\( > > \mathrm{Z} = \operatorname{sqrt}\left( {9 - \mathrm{X} \cdot 2 - \mathrm{Y} \cdot 2}\right) \) ;\n\n\( > > \operatorname{surf}\left( {\mathrm{X},\mathrm{Y},\mathrm{Z}}\right) \)\n\nerror: mesh: X, Y, Z arguments must be real\n\nerror: called from\n\nsurface>__surface__ at line 123 column 9\n\nsurface at line 63 column 19\n\nsurf at line 72 column 10\n\nOf course the problem is that over parts of the rectangular region of interest, the function is undefined (or more precisely, the function values are imaginary). A quick-and-dirty workaround is to simply plot the real part of \( Z \) . This gives a satisfactory result in this case, but in general, this method is less than ideal.\n\n\( > > \operatorname{surf}\left( {\mathrm{X},\mathrm{Y},\operatorname{real}\left( \mathrm{Z}\right) }\right) \)\n\nThe graph restricted to the real component of the function is shown in Figure 6.7.\n\nA better approach would be to graph the function using polar/cylindrical coordinates. To do so, we create an \( {r\theta } \) -meshgrid, with \( 0 \leq r \leq 3 \) and \( 0 \leq \theta \leq {2\pi } \).\n\n\( > > \mathrm{r} = \) linspace \( \left( {0,3,{25}}\right) \) ;\n\n\( > > \) theta \( = \) linspace \( \left( {0,2 * \mathrm{{pi}},{25}}\right) \) ;\n\n\( > > \left\lbrack {RT}\right\rbrack = \operatorname{meshgrid}\left( {r,\text{ theta }}\right) \) ;\n\nIn terms of cylindrical coordinates, \( z = \sqrt{9 - {r}^{2}} \).\n\n\[ > > \mathrm{Z} = \operatorname{sqrt}\left( {9 - \mathrm{R} \cdot {}^{ \land }2}\right) \text{;} \]\n\nNow, calculate \( x \) and \( y \) using the standard polar to rectangular identities, \( x = r\cos \left( \theta \right) \) , \( y = r\sin \left( \theta \right) \) . Be sure to use the meshgrid variables.\n\n\[ > > \mathrm{X} = \mathrm{R} \cdot * \cos \left( \mathrm{T}\right) \]\n\n\[ > > \mathrm{Y} = \mathrm{R} \cdot * \sin \left( \mathrm{T}\right) \]\n\nFinally, graph the surface.\n\n\[ > > \operatorname{surf}\left( {\mathrm{X},\mathrm{Y},\mathrm{Z}}\right) \]\n\nThe improved graph of the hemisphere is shown in Figure 6.8.
Yes
Graph the function \( f\left( x\right) = \ln \left( {x + y - 1}\right) \)
Solution. This function is defined only on the half-plane \( x + y > 1 \) . To graph such a function in Octave we must make a suitable change of variables. In this case, the domain of the function suggests the substitution \( u = x + y \) . We first create a \( {ux} \) -meshgrid, where \( u > 1 \) . Then, using this change of variables, \( z = \ln \left( {u - 1}\right) \) and \( y = u - x \) .\n\n>> % define the ux-mesh\n\n\( > > \mathrm{u} = \operatorname{linspace}\left( {1,5,{30}}\right) \) ;\n\n\( > > \mathrm{x} = \operatorname{linspace}\left( {-2,2,{30}}\right) \) ;\n\n\( > > \left\lbrack {UX}\right\rbrack = \) meshgrid \( \left( {u, x}\right) \) ;\n\n\( \gg \% \) calculate \( \mathrm{y} \) and \( \mathrm{z} \) using the change of variables substitution\n\n\( > > \mathrm{Z} = \log \left( {\mathrm{U} - 1}\right) \)\n\n\( > > \mathrm{Y} = \mathrm{U} - \mathrm{X} \)\n\n\( > > \% \) plot the surface\n\n>> surf(X, Y, Z)\n\nThe resulting graph is shown in Figure 6.9.
Yes
Example 6.2.4. The function\n\n\[ \rho = 1 + \frac{1}{4}\sin \left( {5\phi }\right) \cos \left( {6\theta }\right) ,0 \leq \theta \leq {2\pi },0 \leq \phi \leq \pi \]\n\nin spherical coordinates is known as a bumpy sphere. Graph this function.
Solution. We use a \( {\theta \phi } \) -meshgrid to calculate \( \rho \) . Then we can calculate \( x, y \), and \( z \) using the standard spherical to rectangular coordinate identities.\n\n\( > > \% \) define phi (P) and theta (T)\n\n\( > > \) theta \( = \) linspace \( \left( {0,2 * \mathrm{{pi}},{30}}\right) \) ;\n\n\( > > \) phi \( = \) linspace \( \left( {0,\text{ pi },{30}}\right) \) ;\n\n\( > > \left\lbrack {TP}\right\rbrack = \) meshgrid \( \left( {\text{theta},\text{phi}}\right) \) ;\n\n\( > > \% \) calculate rho \( \left( \mathrm{R}\right) \)\n\n\( > > \mathrm{R} = 1 + 1/4 * \sin \left( {5 * \mathrm{P}}\right) \cdot * \cos \left( {6 * \mathrm{\;T}}\right) \) ;\n\n\( > > \% \) use spherical identities for \( \mathrm{X},\mathrm{Y},\mathrm{Z} \)\n\n\( > > \mathrm{X} = \mathrm{R}. * \sin \left( \mathrm{P}\right) . * \cos \left( \mathrm{T}\right) \) ;\n\n\( > > \mathrm{Y} = \mathrm{R} \cdot * \sin \left( \mathrm{P}\right) \cdot * \sin \left( \mathrm{T}\right) \) ;\n\n\( > > \mathrm{Z} = \mathrm{R} \cdot * \cos \left( \mathrm{P}\right) \)\n\n\( > > \% \) plot the surface\n\n\( > > \operatorname{surf}\left( {\mathrm{X},\mathrm{Y},\mathrm{Z}}\right) \)\n\nThe graph is shown in Figure 6.10.
Yes
The curve in Figure 6.2 lies on the surface of a torus, defined parametrically as\n\n\[ x = \\left( {5 + \\cos \\left( u\\right) }\\right) \\cos \\left( v\\right) \]\n\n\[ y = \\left( {5 + \\cos \\left( u\\right) }\\right) \\sin \\left( v\\right) \]\n\n\[ z = \\sin \\left( u\\right) \]\n\nwhere \( u, v \\in \\left\\lbrack {0,{2\\pi }}\\right\\rbrack \) . Graph this surface.
Solution. We begin by defining the parameters.\n\n\( > > \\mathrm{u} = \) linspace \( \\left( {0,2 * \\mathrm{{pi}},{25}}\\right) \) ;\n\n\( > > \\mathrm{v} = \\mathrm{u} \)\n\n\( > > \\left\\lbrack {UV}\\right\\rbrack = \\operatorname{meshgrid}\\left( {u, v}\\right) \) ;\n\nCalculate \( x, y \), and \( z \) :\n\n\( > > \\mathrm{X} = \\left( {5 + \\cos \\left( \\mathrm{U}\\right) }\\right) \\cdot * \\cos \\left( \\mathrm{V}\\right) \)\n\n\( > > \\mathrm{Y} = \\left( {5 + \\cos \\left( \\mathrm{U}\\right) }\\right) \\cdot * \\sin \\left( \\mathrm{V}\\right) \)\n\n\( > > \\mathrm{Z} = \\sin \\left( \\mathrm{U}\\right) \)\n\nNow, plot the surface.\n\n\( > > \\operatorname{surf}\\left( {\\mathrm{X},\\mathrm{Y},\\mathrm{Z}}\\right) \)\n\n\( > > \) axis \( \\left( {{}^{\\prime }\\text{equal ’}}\\right) \)\n\nThe result is shown in Figure 6.11. Note the use of axis('equal') to force an equal aspect ratio.
Yes
Graph the solid obtained by rotating \( f\left( x\right) = {x}^{2} - {4x} + 5 \), for \( 1 \leq x \leq 4 \), about the \( x \) -axis.
Solution. These commands will graph the surface.\n\n\( \gg \mathrm{x} = \operatorname{linspace}\left( {1,4,{25}}\right) \) ; \( \% \) define the domain\n\n\( > > \mathrm{f} = @\left( \mathrm{x}\right) \mathrm{x} \cdot 2 - 4 * \mathrm{x} + 5 \) ; \( \% \) define the function\n\n\( > > \mathrm{t} = \operatorname{linspace}\left( {0,2 * \mathrm{{pi}},{25}}\right) \) ; \( \% \) define the parameter\n\n\( > > \left\lbrack {XT}\right\rbrack = \operatorname{meshgrid}\left( {x, t}\right) \) ; \( \% \mathrm{{xt}} \) -mesh\n\n\( > > \mathrm{Y} = \mathrm{f}\left( \mathrm{X}\right) \cdot * \cos \left( \mathrm{T}\right) \) ; % calculate Y\n\n\( > > \mathrm{Z} = \mathrm{f}\left( \mathrm{X}\right) \cdot * \sin \left( \mathrm{T}\right) \) \( \% \) calculate \( \mathrm{Z} \)\n\n\( > > \operatorname{surf}\left( {\mathrm{X},\mathrm{Y},\mathrm{Z}}\right) \) \( \% \) graph surface
Yes
Evaluate\n\n\[ \n{\iint }_{R}\left( {{x}^{2}y + {y}^{2}x}\right) {dA} \n\]\n\nover the region \( R \) bounded by the graphs of \( y = {x}^{2} \) and \( y = \sqrt{x} \) .
Solution. An analysis of the region of integration (Figure 6.13) shows that we need to evaluate the following iterated integral:\n\n\[ \n{\int }_{0}^{1}{\int }_{{x}^{2}}^{\sqrt{x}}\left( {{x}^{2}y + {y}^{2}x}\right) {dydx} \n\]\n\nWe need to evaluate over only part of the rectangle \( \left\lbrack {0,1}\right\rbrack \times \left\lbrack {0,1}\right\rbrack \) . One approach is to define the integrand to be 0 for values outside of the region of integration. We do this using logical functions. Logical functions simply test whether a statement is true and return a value of 1 if true or 0 if false. For example \( 2 + 3 < 4 \) returns 0, since the inequality is false. We can also use Boolean operators, like and \( \left( \& \right) \) and or \( \left( \mid \right) \) . Our region demands that we meet two conditions, \( y > {x}^{2} \) and \( y < \sqrt{x} \), so we use these conditions to define the function. By multiplying the integrand by the correct logical operator, it is set to 0 outside the region of interest.\n\n\( > > \% \) double integral over a nonrectangular domain\n\n\( > > \) function \( z = f\left( {x, y}\right) \)\n\n\[ \n\mathrm{z} = \left( {\mathrm{x}.{}^{ \land }2. * \mathrm{y} + \mathrm{y}.{}^{ \land }2. * \mathrm{x}}\right) . * \left( {\left( {\mathrm{y} > \mathrm{x}.{}^{ \land }2}\right) \& \left( {\mathrm{y} < \operatorname{sqrt}\left( \mathrm{x}\right) }\right) }\right) ; \n\]\n\nend\n\n\( > > \operatorname{dblquad}\left( {\prime {\mathrm{f}}^{\prime },0,1,0,1}\right) \)\n\nans \( = {0.10701} \)\n\n![c6a99c62-f1ae-42a9-87a0-435f643c2ede_121_0.jpg](images/c6a99c62-f1ae-42a9-87a0-435f643c2ede_121_0.jpg)\n\nFigure 6.13: Region of integration for Example 6.3.1\n\nThus \( {\int }_{0}^{1}{\int }_{{x}^{2}}^{\sqrt{x}}\left( {{x}^{2}y + {y}^{2}x}\right) {dxdy} \approx {0.10701} \) . This is reasonably close to the exact value of \( 3/{28} \) , but not in perfect agreement. The problem is that we have defined \( f \) as a discontinuous function (see Figure 6.14), but the quadrature algorithm works best on a smooth integrand.
Yes
Use the change of variable formulas in Equations 6.4-6.6 to evaluate\n\n\\[ \n{\\int }_{0}^{1}{\\int }_{{x}^{2}}^{\\sqrt{x}}\\left( {{x}^{2}y + {y}^{2}x}\\right) {dydx} \n\\]
Solution.\n\n\\( > > \\mathrm{f}1 = @\\left( {\\mathrm{x},\\mathrm{y}}\\right) \\mathrm{x} \\cdot \\uparrow 2 \\cdot * \\mathrm{y} + \\mathrm{y} \\cdot \\uparrow 2 \\cdot * \\mathrm{x} \\) ;\n\n\\( > > \\mathrm{y}1 = @\\left( \\mathrm{x}\\right) \\mathrm{x} \\) . ^ 2;\n\n\\( > > \\mathrm{y}2 = @\\left( \\mathrm{x}\\right) \\cdot \\operatorname{sqrt}\\left( \\mathrm{x}\\right) \\) ;\n\n\\( \\gg \\mathrm{f}2 = @\\left( {\\mathrm{x},\\mathrm{u}}\\right) \\mathrm{f}1\\left( {\\mathrm{x},\\mathrm{y}1\\left( \\mathrm{x}\\right) + \\mathrm{u}. * \\left( {\\mathrm{y}2\\left( \\mathrm{x}\\right) - \\mathrm{y}1\\left( \\mathrm{x}\\right) }\\right) }\\right) \\cdot * \\left( {\\mathrm{y}2\\left( \\mathrm{x}\\right) - \\mathrm{y}1\\left( \\mathrm{x}\\right) }\\right) \\) ;\n\n\\( \\gg \\) format long \\% display additional decimal places\n\n\\( \\gg \\operatorname{dblquad}\\left( {\\mathrm{f}2,0,1,0,1}\\right) \\% no quotes around anonymous function name\n\nans \\( = {0.107142857143983} \\)\n\n\\( \\gg 3/{28}\\\\% compare result to known exact answer\n\nans \\( = {0.107142857142857} \\)
Yes
Write an Octave function file that computes\n\n\\[ \n{\\iint }_{R}f\\left( {x, y}\\right) {dA} \n\\]\n\nover the region \\( R \\) bounded by the graphs of \\( y = {y}_{1}\\left( x\\right), y = {y}_{2}\\left( x\\right), x = a \\), and \\( x = b \\), using the change of variables in Equations 6.4-6.6.
Solution. A function file is similar to a script; it is a plain text .m-file containing a series of Octave commands. To be recognized as a function file, the first line of code (excluding comments and white space) must be function. With the file placed in the load path, it can then be run from the command line like any other Octave function. The function name should match the file name. A well-written function file will include details like help text and provisions for error checking. Refer to [3]. We will give a minimal example that accomplishes our change of variables procedure. Use the text editor to enter the following code:\n\n---\n\nOctave Script 6.1: Double integral function file\n\n% function file 'dblint.m'\n\nevaluates \\( \\operatorname{dblquad}\\left( {f,{x1},{x2},{y1},{y2}}\\right) \\)\n\nwhere \\( f \\) is an anonymous function of \\( x \\) and \\( y \\)\n\ny1 and y2 are anonymous functions of \\( \\mathrm{x} \\)\n\nx1 and x2 are real numbers\n\nfunction \\( \\operatorname{val} = \\operatorname{dblint}\\left( {f,{x1},{x2},{y1},{y2}}\\right) \\)\n\n\\( \\mathrm{f}2 = @\\left( {\\mathrm{x},\\mathrm{u}}\\right) \\mathrm{f}\\left( {\\mathrm{x},\\mathrm{y}1\\left( \\mathrm{x}\\right) + \\mathrm{u}. * \\left( {\\mathrm{y}2\\left( \\mathrm{x}\\right) - \\mathrm{y}1\\left( \\mathrm{x}\\right) }\\right) }\\right) . * \\left( {\\mathrm{y}2\\left( \\mathrm{x}\\right) - \\mathrm{y}1\\left( \\mathrm{x}\\right) }\\right) \\) ;\n\nval \\( = \\operatorname{dblquad}\\left( {\\mathrm{f}2,\\mathrm{x}1,\\mathrm{x}2,0,1}\\right) \\) ;\n\nend\n\n---\n\nNote that the comment lines at the top of our function file will be displayed if we type help dblint. Thus we should strive to put a good description of the syntax in those lines. Now, to use this function, saved in our working directory as dblint.m, we need to define the integrand and the functions representing the limits of integration on \\( y \\) . Then we pass these to our function dblint. Let's try it on the integral from Example 6.3.1.\n\n\\( > > \\mathrm{f} = @\\left( {\\mathrm{x},\\mathrm{y}}\\right) \\mathrm{x} \\cdot \\hat{} 2 \\cdot * \\mathrm{y} + \\mathrm{y} \\cdot \\hat{} 2 \\cdot * \\mathrm{x}; \\)\n\n\\( > > \\mathrm{y}1 = @\\left( \\mathrm{x}\\right) \\mathrm{x} \\cdot {}^{ \\land }2 \\) ;\n\n\\( > > \\mathrm{y}2 = @\\left( \\mathrm{x}\\right) \\) sqrt \\( \\left( \\mathrm{x}\\right) \\) ;\n\n\\( > > \\) dblint \\( \\left( {f,0,1,{y1},{y2}}\\right) \\)\n\nans \\( = {0.10714} \\)\n\nIt works!
Yes
Example 6.4.1. Graph the vector field \( \mathbf{F}\left( {x, y}\right) = \langle - x, y\rangle \) .
Solution.\n\n\( > > \mathrm{x} = \operatorname{linspace}\left( {-2,2,{10}}\right) \) ;\n\n\( > > \mathrm{y} = \mathrm{x} \)\n\n\( > > \left\lbrack {XY}\right\rbrack = \operatorname{meshgrid}\left( {x, y}\right) \) ;\n\n\( > > \) quiver \( \left( {\mathrm{X},\mathrm{Y}, - \mathrm{X},\mathrm{Y}}\right) \) ;\n\n\( > > \) grid on\n\nSee Figure 6.15. Some experimentation may be needed to determine the correct grid spacing. Too many points will result in an array of vectors too dense to interpret.
Yes
Example 6.4.2. Plot the vector field \( \mathbf{F}\left( {x, y, z}\right) = \langle 1,1, z\rangle \) .
Solution.\n\n\( > > \mathrm{x} = \operatorname{linspace}\left( {-3,3,{10}}\right) \) ;\n\n\( > > \mathrm{y} = \mathrm{x} \)\n\n\( > > \mathrm{z} = \mathrm{x} \)\n\n\( > > \left\lbrack {XYZ}\right\rbrack = \operatorname{meshgrid}\left( {x, y, z}\right) \) ;\n\n\( \gg \) quiver \( 3\left( {\mathrm{X},\mathrm{Y},\mathrm{Z}\text{, ones}\left( {\text{size}\left( \mathrm{X}\right) }\right) \text{, ones}\left( {\text{size}\left( \mathrm{Y}\right) }\right) ,\mathrm{Z}}\right) \)\n\nNote the use of the ones command to produce the constant terms. The result is in Figure 6.16.
Yes
Plot the slope field along with several solutions of the differential equation\n\n\\[ \n\\frac{dy}{dx} = x \n\\]
Solution. The solution is \\( y = \\frac{1}{2}{x}^{2} + C \\) . For differential equations that cannot be solved so easily, plotting the slope field can be used to get a sense of the solutions. In this example, since we know the solution, we can show how the solutions follow the slope field.\n\nWe need to define the input range as a meshgrid, define the function, then use the function to calculate slopes. To get a good looking graph, we then scale these slope vectors to a unit length. Finally, we plot some solutions for different values of \\( C \\) .\n\n\\( > > \\% \\) define input values\n\n\\( > > \\mathrm{x} = \\) linspace \\( \\left( {-5,5,{30}}\\right) \\) ;\n\n\\( > > \\mathrm{y} = \\mathrm{x} \\)\n\n\\( > > \\left\\lbrack {XY}\\right\\rbrack = \\operatorname{meshgrid}\\left( {x, y}\\right) \\) ;\n\n\\( \\gg \\% \\) define function\n\n\\( > > \\mathrm{f} = @\\left( {\\mathrm{x},\\mathrm{y}}\\right) \\mathrm{x} \\) ;\n\n\\( > > \\% \\) delta-y, relative to 1 unit delta-x\n\n\\( > > \\mathrm{{dY}} = \\mathrm{f}\\left( {\\mathrm{X},\\mathrm{Y}}\\right) \\) ;\n\n\\( > > \\mathrm{{dX}} = \\operatorname{ones}\\left( {\\operatorname{size}\\left( \\mathrm{{dY}}\\right) }\\right) \\) ;\n\n\\( > > \\% \\) factor to scale to unit length\n\n\\( > > \\mathrm{L} = \\operatorname{sqrt}\\left( {1 + \\mathrm{{dY}} \\cdot {}^{ \\land }2}\\right) \\) ;\n\n\\( > > \\% \\) plot the field (note: scale factor 0.5 for shorter arrows)\n\n\\( > > \\) quiver \\( \\left( {\\mathrm{X},\\mathrm{Y},\\mathrm{{dX}}./\\mathrm{L},\\mathrm{{dY}}./\\mathrm{L},{0.5}}\\right) \\)\n\n\\( > > \\operatorname{axis}\\left( \\left\\lbrack \\begin{array}{llll} - 4 & 4 & - 4 & 4 \\end{array}\\right\\rbrack \\right) \\)\n\n\\( > > \\) grid on\n\n\\( \\gg \\) xlabel \\( \\left( {{}^{1}{\\mathrm{x}}^{1}}\\right) \\)\n\n\\( \\gg \\) ylabel \\( \\left( {{}^{\\prime }{\\mathrm{y}}^{\\prime }}\\right) \\)\n\n\\( \\gg \\% \\) add some particular solutions to graph for comparison\n\n\\( > > \\) hold on\n\n\\( > > \\) for \\( \\mathrm{C} = - 4 : 3 \\)\n\nplot \\( \\left( {\\mathrm{x},{0.5} * \\mathrm{x} \\cdot {}^{ \\land }2 + \\mathrm{C},{}^{\\prime }{\\mathrm{r}}^{\\prime },{}^{\\prime }\\text{linewidth}{}^{\\prime },2}\\right) \\)\n\nend\n\n![c6a99c62-f1ae-42a9-87a0-435f643c2ede_130_0.jpg](images/c6a99c62-f1ae-42a9-87a0-435f643c2ede_130_0.jpg)\n\nFigure 6.19: Slope field and solutions
Yes
Solve\n\n\[ \n{y}^{\prime } = {e}^{-{3x}} - {3y},\;y\left( 0\right) = 1 \n\]\n\non \( \left\lbrack {0,3}\right\rbrack \) using a step size of 1 .
Solution. We will generate a series of approximate \( y \) -values at \( x = 0,1,2,3 \) . The value \( {y}_{0} \) is given. We compute the remaining values using Equation 6.7. Here is the first step:\n\n\[ \n{y}_{1} = {y}_{0} + {hf}\left( {{x}_{0},{y}_{0}}\right) \n\]\n\n\[ \n= 1 + \left( 1\right) f\left( {0,1}\right) \n\]\n\n\[ \n= 1 + \left( 1\right) \left( {-2}\right) \n\]\n\n\[ \n= - 1 \n\]\n\n\nThis is then used to compute \( {y}_{2} \) .\n\n\[ \n{y}_{2} = {y}_{1} + {hf}\left( {{x}_{1},{y}_{1}}\right) \n\]\n\n\[ \n= - 1 + \left( 1\right) f\left( {1, - 1}\right) \n\]\n\n\[ \n= {2.0498} \n\]\n\nOne more step:\n\n\[ \n{y}_{3} = {y}_{2} + {hf}\left( {{x}_{2},{y}_{2}}\right) \n\]\n\n\[ \n= {2.0498} + \left( 1\right) f\left( {2,{2.0498}}\right) \n\]\n\n\[ \n= - {4.0971} \n\]\n\nOur approximate solutions are summarized in the following table.\n\n<table><thead><tr><th>\( x \)</th><th>\( y \)</th></tr></thead><tr><td>0</td><td>1.0000</td></tr><tr><td>1</td><td>\( - {1.0000} \)</td></tr><tr><td>2</td><td>2.0498</td></tr><tr><td>3</td><td>\( - {4.0971} \)</td></tr></table>
Yes
Example 6.5.3. Solve\n\n\[ \n{y}^{\prime } = {e}^{-{3x}} - {3y},\;y\left( 0\right) = 1 \n\] \non \( \left\lbrack {0,3}\right\rbrack \) using a step size of 0.1 .
Solution. We will write a fairly general Octave script that can be easily modified for different functions, intervals, and step sizes.\n\nOctave Script 6.4: Euler's method\n\n\( 1\% \) Euler’s method solution for\n\n\( \% \;\mathrm{{dy}}/\mathrm{{dx}} = {\mathrm{e}}^{ \times }\left( {-3\mathrm{x}}\right) - 3\mathrm{y},\mathrm{y}\left( 0\right) = 1 \) on \( \left\lbrack {0,3}\right\rbrack \)\n\n\( 4\% \) define function and initial condition\n\n5 \( \mathrm{f} = @\left( {\mathrm{x},\mathrm{y}}\right) \exp \left( {-3 * \mathrm{x}}\right) - 3 * \mathrm{y} \) ;\n\n6 \( \mathrm{y}0 = 1 \) ;\n\n\( 8\% \) define interval and step size\n\n9 a \( = 0 \) ;\n\n10 \( \mathrm{b} = 3 \) ;\n\n1 h \( = {0.1};\% \) note: step size must divide b-a\n\n\( 2\mathrm{n} = \left( {\mathrm{b} - \mathrm{a}}\right) /\mathrm{h} \)\n\n![c6a99c62-f1ae-42a9-87a0-435f643c2ede_132_0.jpg](images/c6a99c62-f1ae-42a9-87a0-435f643c2ede_132_0.jpg)\n\nFigure 6.20: Euler's method solution for Example 6.5.3\n\n14 % define x-values\n\n\( {sx} = \left\lbrack {a : h : b}\right\rbrack ; \)\n\n\( \% \) calculate \( \mathrm{y} - \) values\n\n\( \mathrm{y}\left( 1\right) = \mathrm{y}0 \)\n\nfor \( \mathrm{i} = 1 : \mathrm{n} \)\n\n\( y\left( {i + 1}\right) = y\left( i\right) + h * f\left( {x\left( i\right), y\left( i\right) }\right) ; \)\n\nend\n\n23 % plot solutions\n\n\( {}_{24} > > \) plot \( \left( {\mathrm{x},\mathrm{y},{}^{\prime }\mathrm{o} : {}^{\prime },{}^{\prime }\text{linewidth}{}^{\prime },2}\right) \)\n\nFigure 6.20 shows the approximated solution compared to the exact solution, which is known to be \( y = {e}^{-{3x}}\left( {x + 1}\right) \) .
Yes
Use lsode to solve the differential equation\n\n\\[ \n\\frac{dx}{dt} = x\\left( {{t}^{2} + 1}\\right) \n\\] \n\non \\( \\left\\lbrack {0,2}\\right\\rbrack \\), with initial condition \\( x\\left( 0\\right) = 1 \\) .
Solution. To solve using lsode, we define the function listing \\( x \\) first, then \\( t \\) .\n\n\\( \\gg \\% \\) define the function, input values, and initial condition\n\n\\( > > \\mathrm{f} = @\\left( {\\mathrm{x},\\mathrm{t}}\\right) \\mathrm{x} \\cdot * \\left( {\\mathrm{t} \\cdot {}^{ \\land }2 + 1}\\right) ;\\; \\% \\mathrm{x} \\) first, then \\( \\mathrm{t} \\)\n\n\\( > > \\mathrm{t} = \\operatorname{linspace}\\left( {0,2,{50}}\\right) \\)\n\n\\( > > \\mathrm{x}0 = 1 \\)\n\n\\( > > \\% \\) calculate the solutions\n\n\\( > > \\) x_sol \\( = \\) lsode \\( \\left( {\\mathrm{f},\\mathrm{x}0,\\mathrm{t}}\\right) \\)\n\n\\( > > \\% \\) plot the solutions\n\n\\( > > \\) plot \\( \\left( {\\mathrm{t},{\\mathrm{x}}_{ - }\\mathrm{{sol}},{}^{\\prime }\\text{linewidth}{}^{\\prime },2}\\right) \\)\n\n\\( \\gg \\) grid on\n\n\\( \\gg \\) xlabel \\( \\left( {{}^{\\prime }{\\mathrm{t}}^{\\prime }}\\right) \\)\n\n\\( \\gg \\) ylabel \\( \\left( {{}^{\\prime }{\\mathrm{x}}^{\\prime }}\\right) \\)\n\nThe solution is shown in Figure 6.21.
Yes
Use ode45 to solve the differential equation\n\n\[ \n\\frac{dx}{dt} = x\\left( {{t}^{2} + 1}\\right) \n\]\n\non \( \\left\\lbrack {0,2}\\right\\rbrack \), with initial condition \( x\\left( 0\\right) = 1 \) . Compare to the lsode solution from Example 6.5.4.
Solution. We need to redefine the function. MATLAB convention requires giving the independent variable first, the opposite of what lsode required.\n\n\( > > \\% \) define the function, input values, and initial condition\n\n\( > > \\mathrm{f} = @\\left( {\\mathrm{t},\\mathrm{x}}\\right) \\cdot \\mathrm{x} \\cdot * \\left( {\\mathrm{t} \\cdot {}^{ \\land }2 + 1}\\right) ;\\;\\% \\mathrm{t} \) first, then \( \\mathrm{x} \)\n\n\( > > \) tspan \( = \\left\\lbrack \\begin{array}{ll} 0 & 2 \\end{array}\\right\\rbrack \) ;\n\n\( > > \\mathrm{x}0 = 1 \) ;\n\n\( > > \\% \) calculate the solutions\n\n\( > > \\left\\lbrack {{\\mathrm{t}}_{ - }\\mathrm{{sol}},{\\mathrm{x}}_{ - }\\mathrm{{sol}}}\\right\\rbrack = \\mathrm{{ode}}{45}\\left( {\\mathrm{f},\\mathrm{{tspan}},\\mathrm{x}0}\\right) \) ;\n\n\( > > \\% \) plot the solutions\n\n\( > > \\operatorname{plot}\\left( {{\\mathrm{t}}_{ - }\\mathrm{{sol}},{\\mathrm{x}}_{ - }\\mathrm{{sol}},{}^{\\prime }\\mathrm{o} - {}^{\\prime }}\\right) \n\nFigure 6.22 compares the lsode and ode45 solutions. The solutions seem to agree.
Yes
Find the general solution for \( {y}^{\prime } = {e}^{-{3x}} - {3y} \) . Then, find the particular solution if \( y\left( 0\right) = 1 \) .
Solution. First, the symbolic package must be installed and loaded. Refer to Section 3.4 for details.\n\nTo set things up, we declare \( y \) as a symbolic function of \( x \) .\n\n\( > > \) pkg load symbolic\n\n\( > > \) syms \( y\left( x\right) \)\n\nNow, define the differential equation. We do this using the equality operator, \
No
Example 1.1.1. A sphere of solid gold has a mass of 100 kg and the density of gold is \( {19.3}\mathrm{\;g}/{\mathrm{{cm}}}^{3} \) . What is the radius of the sphere?
Solution. This problem is more involved. To answer this, let \( r \) be the unknown radius of the sphere in units of cm. The volume of the sphere is \( V = \frac{4}{3}\pi {r}^{3} \) . Since the sphere is solid gold, the density of gold is the ratio\n\n\[ \text{ density of gold } = \frac{\text{ mass of sphere }}{\text{ volume of sphere }} \]\n\nPlugging in what we know, we get the equation\n\n\[ {19.3}\frac{\mathrm{g}}{{\mathrm{{cm}}}^{3}} = \left( \frac{{100}\mathrm{\;{kg}}}{\frac{4}{3}\pi {\mathrm{r}}^{3}}\right) = \left( \frac{{100}\mathrm{\;{kg}}}{\frac{4}{3}\pi {\mathrm{r}}^{3}}\right) \left( \frac{{1000}\mathrm{\;g}}{1\mathrm{\;{kg}}}\right) = \left( \frac{{10}^{5}\mathrm{\;g}}{\frac{4}{3}\pi {\mathrm{r}}^{3}}\right) \]\n\nSolving for \( {r}^{3} \) we find\n\n\[ {r}^{3} = {1236.955516}{\mathrm{\;{cm}}}^{3} \]\n\nfrom which we get\n\n\[ r = {\left( {1237}{\mathrm{\;{cm}}}^{3}\right) }^{1/3} = {10.73457}\mathrm{\;{cm}} \]
Yes
Example 1.2.1. A water pipe mounted to the ceiling has a leak. It is dripping onto the floor below and creates a circular puddle of water. The surface area of this puddle is increasing at a constant rate of 4 cm²/hour. Find the surface area and dimensions of the puddle after 84 minutes.
Solution. The quantity changing is \
No
Example 2.2.1. As the marketing director of Turboweb software, you have been asked to deliver a brief message at the annual stockholders meeting on the performance of your product. Your staff has assembled this tabular collection of data; how can you convey the content of this table most clearly?
One idea is to simply flash an overhead slide of this data to the audience; this can be deadly! A better idea is to use a visual aid. Suppose we let the variable \( x \) represent the week and the variable \( y \) represent the gross sales (in thousands of dollars) in week \( x \) . We can then plot the points \( \left( {x, y}\right) \) in the \( {xy} \) -coordinate system; see Figure 2.6.\n\nNotice, the units on the two axes are very different: \( y \) -axis units are \
No
Example 2.3.1. Return to the tossed ball scenario on page 1. How do we decide where to draw a coordinate system in the picture?
Figure 2.7 on page 16 shows four natural choices of \( {xy} \) -coordinate system. To choose a coordinate system we must specify the origin. The four logical choices for the origin are either the top of the cliff, the bottom of the cliff, the launch point of the ball or the landing point of the ball. So, which choice do we make? The answer is that any of these choices will work, but one choice may be more natural than another. For example, Figure 2.7(b) is probably the most natural choice: in this coordinate system, the motion of the ball takes place entirely in the first quadrant, so the \( x \) and \( y \) coordinates of any point on the path of the ball will be non-negative.
Yes
Example 2.3.2. Michael and Aaron are running toward each other, beginning at opposite ends of a \( {10},{000}\mathrm{{ft}} \) . airport runway, as pictured in Figure 2.8 on page 17. Where and when will these guys collide?
Solution. This problem requires that we find the \
No
Example 2.4.1. You are in an airplane flying from Denver to New York. How far will you fly? To what extent will you travel north? To what extent will you travel east?
Consider two points \( P = \left( {{x}_{1},{y}_{1}}\right) \) and \( Q = \left( {{x}_{2},{y}_{2}}\right) \) in the \( {xy} \) coordinate system, where we assume that the units on each axis are the same; for example, both in units of \
No
Two cars depart from a four way intersection at the same time, one heading East and the other heading North. Both cars are traveling at the constant speed of 30 ft/sec. Find the distance (in miles) between the two cars after 1 hour 12 minutes. In addition, determine when the two cars would be exactly 1 mile apart.
Solution. Begin with a picture of the situation. We have indicated the locations of the two vehicles after \( t \) seconds and the distance \( d \) between them at time \( t \) . By the distance formula, the distance between them is\n\n\[ d = \sqrt{{\left( a - 0\right) }^{2} + {\left( 0 - b\right) }^{2}} \]\n\n\[ = \sqrt{{a}^{2} + {b}^{2}}\text{. } \]\n\nThis formula is a first step; the difficulty is that we have traded the mystery distance \( d \) for two new unknown numbers \( a \) and \( b \) . To find the coordinate \( a \) for the Eastbound car, we know the car is moving at the rate of \( {30}\mathrm{{ft}}/\mathrm{{sec}} \), so it will travel 30t feet after \( t \) seconds; i.e., \( a = {30t} \) . Similarly, we find that \( b = {30}\mathrm{t} \) . Substituting into the formula for \( d \) we arrive at\n\n\[ d = \sqrt{{\left( {30}t\right) }^{2} + {\left( {30}t\right) }^{2}} \]\n\n\[ = \sqrt{2{t}^{2}{\left( {30}\right) }^{2}} \]\n\n\[ = {30}\mathrm{t}\sqrt{2}\text{.} \]\n\nFirst, we need to convert 1 hour and 12 minutes into seconds so that our formula can be used:\n\n1 hr \( {12}\mathrm{\;{min}} = 1 + {12}/{60}\mathrm{{hr}} \)\n\n\[ = {1.2}\mathrm{{hr}} \]\n\n\[ = \left( {{1.2}\mathrm{{hr}}}\right) \left( \frac{{60}\mathrm{\;{min}}}{\mathrm{{hr}}}\right) \left( \frac{{60}\mathrm{{sec}}}{\mathrm{{min}}}\right) \]\n\n\[ = 4,{320}\mathrm{{sec}}\text{. } \]\n\nSubstituting \( \mathrm{t} = 4,{320}\mathrm{{sec}} \) and recalling that \( 1\mathrm{{mile}} = 5,{280}\mathrm{{feet}} \), we arrive at\n\n\[ d = {129},{600}\sqrt{2}\text{feet} \]\n\n\[ = {183},{282}\text{feet} \]\n\n\[ = {34.71}\text{miles.} \]\n\nFor the second question, we specify the distance being 1 mile and want to find when this occurs. The idea is to set \( d \) equal to 1 mile and solve for t. However, we need to be careful, since the units for d are feet:\n\n\[ {30}\mathrm{t}\sqrt{2} = \mathrm{d} \]\n\n\[ = 5,{280} \]\n\nSolving for t:\n\n\[ t = \frac{5,{280}}{{30}\sqrt{2}} \]\n\n\[ = {124.45}\text{seconds} \]\n\n\[ = 2\text{minutes 4 seconds.} \]\n\nThe two cars will be 1 mile apart in 2 minutes, 4 seconds.
Yes
(a) If \( x \neq 1 \) ,\n\n\[ \n\frac{{x}^{2} - 1}{x + 1} = \frac{{x}^{2} + \left( {-1}\right) 1}{x + 1} \n\]
\[ \n= \frac{{x}^{2}}{x} + \frac{-1}{1} \n\]\n\n\[ \n= x - 1 \n\]
Yes
Glo-Tek Industries has designed a new halogen street light fixture for the city of Seattle. According to the product literature, when placed on a 50 foot light pole, the resulting useful illuminated area is a circular disc 120 feet in diameter. Assume the light pole is located 20 feet east and 40 feet north of the intersection of Parkside Ave. (a north/south street) and Wilson St. (an east/west street). What portion of each street is illuminated?
The illuminated area is a circular disc whose diameter and center are both known. Consequently, we really need to study the intersection of this circle with the two streets. Begin by imposing the pictured coordinate system; we will use units of feet for each axis. The illuminated region will be a circular disc centered at the point \( \\left( {{20},{40}}\\right) \) in the coordinate system; the radius of the disc will be \( r = {60} \) feet.\n\nWe need to find the points of intersection \( P, Q, R \), and \( S \) of the circle with the \( x \) -axis and the \( y \) -axis. The equation for the circle with \( r = {60} \) and center \( \\left( {h, k}\\right) = \\left( {{20},{40}}\\right) \) is\n\n\[{\\left( x - {20}\\right) }^{2} + {\\left( y - {40}\\right) }^{2} = {3600}.\n\nTo find the circular disc intersection with the \( y \) -axis, we have a system of two equations to work with:\n\n\[{\\left( x - {20}\\right) }^{2} + {\\left( y - {40}\\right) }^{2} = 3,{600};\n\n\[x = 0\\text{.}\n\nTo find the intersection points we simultaneously solve both equations. To do this, we replace \( x = 0 \) in the first equation (i.e., we impose the conditions of the second equation on the first equation) and arrive at\n\n\[{\\left( 0 - {20}\\right) }^{2} + {\\left( y - {40}\\right) }^{2} = 3,{600}\n\n\[{400} + {\\left( y - {40}\\right) }^{2} = 3,{600}\n\n\[{\\left( y - {40}\\right) }^{2} = 3,{200}\n\n\[\\left( {y - {40}}\\right) = \\pm \\sqrt{3,{200}}\n\n\[y = {40} \\pm \\sqrt{3,{200}}\n\n\[= - {16.57}\\text{or 96.57 .}\n\nNotice, we have two solutions. This means that the circle and y-axis intersect at the points \( P = \\left( {0,{96.57}}\\right) \) and \( Q = \\left( {0, - {16.57}}\\right) \) . Similarly, to find the circular disc intersection with the \( x \) -axis, we have a system of two equations to work with:\n\n\[{\\left( x - {20}\\right) }^{2} + {\\left( y - {40}\\right) }^{2} = 3,{600}\n\n\[y = 0\\text{.}\n\nReplace \( y = 0 \) in the first equation (i.e., we impose the conditions of the second equation on the first equation) and arrive at\n\n\[{\\left( x - {20}\\right) }^{2} + {\\left( 0 - {40}\\right) }^{2} = 3,{600}\n\n\[{\\left( x - {20}\\right) }^{2} = 2,{000}\n\n\[\\left( {x - {20}}\\right) = \\pm \\sqrt{2,{000}}\n\n\[x = {20} \\pm \\sqrt{2,{000}}\n\n\[= - {24.72}\\text{or 64.72 .}\n\nConclude the circle and \( x \) -axis intersect at the points \( S = \\left( {{64.72},0}\\right) \) and \( R = \\left( {-{24.72},0}\\right) \).
Yes
Problem 3.8. (a) Solve for \( x \) :
\[ \frac{{x}^{2} - {2x} + 1}{x + 5} = x - 2 \]
No
Example 4.3.3. Consider the line \( \ell \) , in Figure 4.6, through the two points \( \mathrm{P} = \left( {1,1}\right) \) and \( \mathrm{Q} = \left( {4,5}\right) \) . Then the slope of \( \ell \) is \( m = 4/3 \) and \( \ell \) consists of all pairs of points \( \left( {x, y}\right) \) such that the coordinates \( x \) and \( y \) satisfy the equation \( y = \) \( \frac{4}{3}\left( {x - 1}\right) + 1 \) .
Letting \( x = 0,1,6 \) and -1, we conclude that the following four points lie on the line \( \ell : \left( {0,\frac{4}{3}\left( {0 - 1}\right) + 1}\right) = \) \( \left( {0,\frac{-1}{3}}\right) ,\left( {1,\frac{4}{3}\left( {1 - 1}\right) + 1}\right) = \left( {1,1}\right) ,\left( {6,\frac{4}{3}\left( {6 - 1}\right) + 1}\right) = \left( {6,\frac{23}{3}}\right) \) and \( \left( {-1,\frac{4}{3}\left( {-1 - 1}\right) + 1}\right) = \left( {-1,\frac{-5}{3}}\right) \) . By the same reasoning, the point \( \left( {0,0}\right) \) does not lie on the line \( \ell \) . As a set of points in the plane, we have\n\n\[ \ell = \left\{ {\left( {x,\frac{4}{3}\left( {x - 1}\right) + 1}\right) |x\;\text{is any real number}}\right\} \]
Yes
The yearly resident tuition at the University of Washington was $1827 in 1989 and $2907 in 1995. Assume that the tuition growth at the UW follows a linear model. What will be the tuition in the year 2000? When will yearly tuition at the University of Washington be $10,000?
Solution. If we consider a coordinate system where the \( x \) -axis represents the year and the \( y \) -axis represents dollars, we are given two data points: \( P = \left( {{1989},1,{827}}\right) \) and \( Q = \left( {{1995},2,{907}}\right) \) . Using the two-point formula for the equation of line through \( P \) and \( Q \), we obtain the equation\n\n\[ y = {180}\left( {x - {1989}}\right) + 1,{827}. \]\n\nThe graph of this equation gives a line through the given points as pictured in Figure 4.10.\n\nIf we let \( x = {2000} \), we get \( y = \$ 3,{807} \), which tells us the tuition in the year 2000. On the other hand, if we set the equation equal to \( \$ {10},{000} \), we can solve for \( x \) :\n\n\[ {10},{000} = {180}\left( {x - {1989}}\right) + 1,{827} \]\n\n\[ 8,{173} = {180}\left( {x - {1989}}\right) \]\n\n\[ 2,{034.4} = x\text{.} \]\n\nConclude the tuition is \$10,000 in the year 2035.
Yes
Let \( \ell \) be a line in the plane passing through the points \( \left( {1,1}\right) \) and \( \left( {6, - 1}\right) \). Find a linear equation whose graph is a line parallel to \( \ell \) passing through 5 on the y-axis. Find a linear equation whose graph is perpendicular to \( \ell \) and passes through \( \left( {4,6}\right) \).
Solution. Letting \( P = \left( {1,1}\right) \) and \( Q = \left( {6, - 1}\right) \), apply the \
No
1. Find a linear equation whose graph is the line along which the crop duster travels.
Take \( Q = \left( {-1,0}\right) \) and \( S = \left( {{1.5}, - 2}\right) = \) duster spotting point. Construct a line through \( Q \) and \( S \) . The slope is \( - {0.8} = m \) and the line equation becomes:\n\n\[ y = - {0.8x} - {0.8} \]
Yes
Example 4.11.2. Olga is running in the xy-plane, and the coordinate are given in meters (so, for example, the point \( \left( {1,0}\right) \) is one meter from the origin \( \left( {0,0}\right) ) \) . She runs in a straight line, starting at the point \( \left( {3,5}\right) \) and running along the line \( y = - \frac{1}{3}x + 6 \) at a speed of 7 meters per second, heading away from the y-axis. What are her parametric equations of motion?
Solution. This example differs in some respects from the last example. In particular, instead of knowing where the runner is at two points in time, we only know one point, and have other information given to us about the speed and path of the runner. One approach is to use this new information to find where the runner is at some other point in time: this will then give us exactly the same sort of information as we used in the last example, and so we may solve it in an identical manner.\n\nWe know that Olga starts at the point \( \left( {3,5}\right) \) . Letting \( t = 0 \) represent the time when she starts, we then know that when \( t = 0, x = 3 \) and \( y = 5 \) .\n\nTo get another point (and time), we can use the fact that we know what line she travels along, and which direction she runs. We may consider any point on the line in the correct direction: any will do. For instance, the point \( \left( {6,4}\right) \) is on the line. We then need to find when Olga reaches this point. To do this, we find the distance from her starting point to the point \( \left( {6,4}\right) \), and divide this by her speed. The time she takes to get to \( \left( {6,4}\right) \) is thus\n\n\[ \frac{\sqrt{{\left( 6 - 3\right) }^{2} + {\left( 4 - 5\right) }^{2}}}{7} = {0.45175395}\text{ seconds }.\]\n\nAt this point, we are now in the same situation as in the last example. We know two facts: when \( t = 0, x = 3 \) and \( y = 5 \), and when \( t = {0.45175395} \) , \( x = 6 \) and \( y = 4 \) . As we saw in the last example, this is enough information to find the parametric equations of motion.\n\nWe seek \( a, b, c \), and \( d \) such that Olga’s location \( t \) seconds after she starts is \( \left( {x, y}\right) \) where\n\n\[ x = a + {bt}\text{ and }y = c + {dt}. \]\n\nWhen \( \mathrm{t} = 0,\mathrm{x} = 3 \), and \( \mathrm{y} = 5 \), so\n\n\[ x = 3 = a + b\left( 0\right) = a\text{ and }y = 5 = c + d\left( 0\right) = c \]\n\nand so \( a = 3 \) and \( c = 5 \) . Also, when \( t = {0.45175395}, x = 6 \) and \( y = 4 \), so\n\n\[ x = 6 = a + b\left( {0.45175395}\right) = 3 + b\left( {0.45175395}\right) \text{ and }y = 4 = c + d\left( {0.45175395}\right) = 5 + d\left( {0.45175395}\right) . \]\n\nSolving these equations for \( b \) and \( d \), we find\n\n\[ b = \frac{3}{0.45175395} = {6.64078311}\text{ and }d = \frac{-1}{0.45175395} = - {2.21359436}. \]\n\nThus, Olga's equations of motion are\n\n\[ x = 3 + {6.64078311}\mathrm{t}, y = 5 - {2.21359436}\mathrm{t}\text{.} \]
Yes