CHAPTER 2. FIRST ORDER ODEs 2.3 Linear Equations Calistus Ngonghala University of Florida CNN 2.3 Linear Equations Outline 1 Introduction 2 Identifying first order linear equations 3 Solving first order linear equations 4 Initial Value Problems Introduction In this chapter we are learning methods to solve ODEs. Introduction In this chapter we are learning methods to solve ODEs. The main principle involved in solving ODEs is to: Introduction In this chapter we are learning methods to solve ODEs. The main principle involved in solving ODEs is to: recognize the class to which the ODE belongs Introduction In this chapter we are learning methods to solve ODEs. The main principle involved in solving ODEs is to: recognize the class to which the ODE belongs learn and use the methods that allow us to solve this class of ODE problems Introduction In this chapter we are learning methods to solve ODEs. The main principle involved in solving ODEs is to: recognize the class to which the ODE belongs learn and use the methods that allow us to solve this class of ODE problems In this Chapter we only work with first order ODEs. Introduction In this chapter we are learning methods to solve ODEs. The main principle involved in solving ODEs is to: recognize the class to which the ODE belongs learn and use the methods that allow us to solve this class of ODE problems In this Chapter we only work with first order ODEs. We will consider first order linear equations. Identifying first order linear equations Like separable ODEs, linear can be solved easily. Identifying first order linear equations Like separable ODEs, linear can be solved easily. Definition A first order linear ODE is an equation of the form: a1 (x) dy + a0 (x)y = b(x) dx (1) where a1 (x) 6= 0, a0 (x), and b(x) depend only on x but not on y. Identifying first order linear equations Like separable ODEs, linear can be solved easily. Definition A first order linear ODE is an equation of the form: a1 (x) dy + a0 (x)y = b(x) dx (1) where a1 (x) 6= 0, a0 (x), and b(x) depend only on x but not on y. At times the ODE will not be written in the form (1) so that we can see right away that it is linear. Identifying first order linear equations Like separable ODEs, linear can be solved easily. Definition A first order linear ODE is an equation of the form: a1 (x) dy + a0 (x)y = b(x) dx (1) where a1 (x) 6= 0, a0 (x), and b(x) depend only on x but not on y. At times the ODE will not be written in the form (1) so that we can see right away that it is linear. We may need to rewrite it in the form above or use methods from Chapter 1 to identify a linear equation. Identifying first order linear equations Like separable ODEs, linear can be solved easily. Definition A first order linear ODE is an equation of the form: a1 (x) dy + a0 (x)y = b(x) dx (1) where a1 (x) 6= 0, a0 (x), and b(x) depend only on x but not on y. At times the ODE will not be written in the form (1) so that we can see right away that it is linear. We may need to rewrite it in the form above or use methods from Chapter 1 to identify a linear equation. Some ODEs are both separable and linear Identifying linear equations Example Determine whether the given first order ODE is linear or non-linear ex cos x + (sin x)y = x3 dy dx Identifying linear equations Example Determine whether the given first order ODE is linear or non-linear ex cos x + (sin x)y = x3 dy dx Solution First we check whether the equation is written in the form (1). If not, we try to write the equation in this form: Identifying linear equations Example Determine whether the given first order ODE is linear or non-linear ex cos x + (sin x)y = x3 dy dx Solution First we check whether the equation is written in the form (1). If not, we try to write the equation in this form: x3 dy − (sin x)y = ex cos x dx Hence, here a1 (x) = x3 a0 (x) = − sin x b(x) = ex cos x Identifying linear equations Example Determine whether the given first order ODE is linear or non-linear ex cos x + (sin x)y = x3 dy dx Solution First we check whether the equation is written in the form (1). If not, we try to write the equation in this form: x3 dy − (sin x)y = ex cos x dx Hence, here a1 (x) = x3 a0 (x) = − sin x We conclude the equation is linear. b(x) = ex cos x Example 1 – Problem #4/p.54 Example Determine whether the given equation is separable, linear, both or dy + y ln t neither. 3t = et dt Solution Example 1 – Problem #4/p.54 Example Determine whether the given equation is separable, linear, both or dy + y ln t neither. 3t = et dt Solution First, we express the ODE in the form (1): pause et dy + (ln t)y = 3t dt Example 1 – Problem #4/p.54 Example Determine whether the given equation is separable, linear, both or dy + y ln t neither. 3t = et dt Solution First, we express the ODE in the form (1): pause et dy + (ln t)y = 3t dt Hence, a1 (t) = et a0 (t) = ln t b(t) = 3t Example 1 – Problem #4/p.54 Example Determine whether the given equation is separable, linear, both or dy + y ln t neither. 3t = et dt Solution First, we express the ODE in the form (1): pause et dy + (ln t)y = 3t dt Hence, a1 (t) = et a0 (t) = ln t We conclude the equation is linear. b(t) = 3t Example 1 – Problem #4/p.54 Solution To check for separability, we write the equation in the form dy = f (t, y) dt Example 1 – Problem #4/p.54 Solution To check for separability, we write the equation in the form dy = f (t, y) dt Then check whether the right-hand side is of the form: f (t, y) = g(t)p(y) Example 1 – Problem #4/p.54 Solution To check for separability, we write the equation in the form dy = f (t, y) dt Then check whether the right-hand side is of the form: f (t, y) = g(t)p(y) Solve the ODE for y 0 : Example 1 – Problem #4/p.54 Solution To check for separability, we write the equation in the form dy = f (t, y) dt Then check whether the right-hand side is of the form: f (t, y) = g(t)p(y) Solve the ODE for y 0 : dy 3t − ln ty = dt et Example 1 – Problem #4/p.54 Solution To check for separability, we write the equation in the form dy = f (t, y) dt Then check whether the right-hand side is of the form: f (t, y) = g(t)p(y) Solve the ODE for y 0 : dy 3t − ln ty = dt et The numerator of the right-hand side cannot be factored as a function of t times a function of y. Example 1 – Problem #4/p.54 Solution To check for separability, we write the equation in the form dy = f (t, y) dt Then check whether the right-hand side is of the form: f (t, y) = g(t)p(y) Solve the ODE for y 0 : dy 3t − ln ty = dt et The numerator of the right-hand side cannot be factored as a function of t times a function of y. We conclude the equation is NOT separable. Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Solution First we identify the independt and dependent variables Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Solution First we identify the independt and dependent variables Independent variable: θ Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Solution First we identify the independt and dependent variables Independent variable: θ Dependent variable: and dependent r Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Solution First we identify the independt and dependent variables Independent variable: θ Dependent variable: and dependent r We know that because of dr dθ Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Solution First we identify the independt and dependent variables Independent variable: θ Dependent variable: and dependent r We know that because of dr dθ Linearity Express the equation in the form (1): dr − 3r = θ3 dθ Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Solution First we identify the independt and dependent variables Independent variable: θ Dependent variable: and dependent r We know that because of dr dθ Linearity Express the equation in the form (1): Hence, a1 (θ) = 1 a0 (θ) = −3 dr − 3r = θ3 dθ b(θ) = θ3 Example 2 – Problem #6/p.54 Example Determine whether the given equation is separable, linear, both or dr − θ3 neither. 3r = dθ Solution First we identify the independt and dependent variables Independent variable: θ Dependent variable: and dependent r We know that because of dr dθ Linearity Express the equation in the form (1): Hence, a1 (θ) = 1 a0 (θ) = −3 We conclude the equation is linear dr − 3r = θ3 dθ b(θ) = θ3 Example 2 – Problem #6/p.54 Solution To check for separability, we write the equation in the form dr = f (θ, r) dθ Example 2 – Problem #6/p.54 Solution To check for separability, we write the equation in the form dr = f (θ, r) dθ and we can write the right-hand side as f (θ, r) = g(θ)p(r) Example 2 – Problem #6/p.54 Solution To check for separability, we write the equation in the form dr = f (θ, r) dθ and we can write the right-hand side as f (θ, r) = g(θ)p(r) Solve the ODE for r0 : dr = θ3 + 3r dθ Example 2 – Problem #6/p.54 Solution To check for separability, we write the equation in the form dr = f (θ, r) dθ and we can write the right-hand side as f (θ, r) = g(θ)p(r) Solve the ODE for r0 : dr = θ3 + 3r dθ The right-hand side cannot be factored as a function of θ times a function of r. Example 2 – Problem #6/p.54 Solution To check for separability, we write the equation in the form dr = f (θ, r) dθ and we can write the right-hand side as f (θ, r) = g(θ)p(r) Solve the ODE for r0 : dr = θ3 + 3r dθ The right-hand side cannot be factored as a function of θ times a function of r. We conclude the equation is NOT separable. Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx After ascertaining that the equation is linear, we need a method to solve it Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx After ascertaining that the equation is linear, we need a method to solve it To understand how the method emerged, we introduce the method in steps. Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx After ascertaining that the equation is linear, we need a method to solve it To understand how the method emerged, we introduce the method in steps. Case 1. Assume a0 (x) = 0. Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx After ascertaining that the equation is linear, we need a method to solve it To understand how the method emerged, we introduce the method in steps. Case 1. Assume a0 (x) = 0. Then the equation (1) becomes: a1 (x) dy = b(x) dx Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx After ascertaining that the equation is linear, we need a method to solve it To understand how the method emerged, we introduce the method in steps. Case 1. Assume a0 (x) = 0. Then the equation (1) becomes: a1 (x) dy = b(x) dx We may rewrite this equation as dy b(x) = dx a1 (x) Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx After ascertaining that the equation is linear, we need a method to solve it To understand how the method emerged, we introduce the method in steps. Case 1. Assume a0 (x) = 0. Then the equation (1) becomes: a1 (x) dy = b(x) dx We may rewrite this equation as dy b(x) = dx a1 (x) This equation is separable and can be solved as such. Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: a1 (x) dy + a01 (x)y = b(x) dx Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: dy + a01 (x)y = b(x) dx We may rewrite this equation as a1 (x) Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: dy + a01 (x)y = b(x) dx We may rewrite this equation as a1 (x) d (a1 (x)y) = b(x) dx Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: dy + a01 (x)y = b(x) dx We may rewrite this equation as a1 (x) d (a1 (x)y) = b(x) dx Integrating both sides with respect to x, we have Z Z d (a1 (x)y) dx = b(x) dx dx Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: dy + a01 (x)y = b(x) dx We may rewrite this equation as a1 (x) d (a1 (x)y) = b(x) dx Integrating both sides with respect to x, we have Z Z d (a1 (x)y) dx = b(x) dx dx Hence, Z a1 (x)y = b(x) dx + C Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: dy + a01 (x)y = b(x) dx We may rewrite this equation as a1 (x) d (a1 (x)y) = b(x) dx Integrating both sides with respect to x, we have Z Z d (a1 (x)y) dx = b(x) dx dx Hence, Z a1 (x)y = b(x) dx + C Solving for y, we have an explicit solution: Solving first order linear equations Linear ODE: a1 (x) dy + a0 (x)y = b(x) dx Case 2. Assume a0 (x) = a01 (x). Then the equation (1) becomes: dy + a01 (x)y = b(x) dx We may rewrite this equation as a1 (x) d (a1 (x)y) = b(x) dx Integrating both sides with respect to x, we have Z Z d (a1 (x)y) dx = b(x) dx dx Hence, Z a1 (x)y = b(x) dx + C Solving for y, we have an explicit solution: 1 y= a1 (x) Z b(x) dx + C Example 3 – Not a book problem Example Obtain a general solution to the equation dy = x2 + 2x − 1 − 2xy (x2 + 1) dx Example 3 – Not a book problem Example Obtain a general solution to the equation dy = x2 + 2x − 1 − 2xy (x2 + 1) dx Solution First, we recognize that the equation is linear and write it in the linear ODE form Example 3 – Not a book problem Example Obtain a general solution to the equation dy = x2 + 2x − 1 − 2xy (x2 + 1) dx Solution First, we recognize that the equation is linear and write it in the linear ODE form (x2 + 1) dy + 2xy = x2 + 2x − 1 dx Example 3 – Not a book problem Example Obtain a general solution to the equation dy = x2 + 2x − 1 − 2xy (x2 + 1) dx Solution First, we recognize that the equation is linear and write it in the linear ODE form (x2 + 1) dy + 2xy = x2 + 2x − 1 dx We recognize that a1 (x) = x2 + 1 a0 (x) = 2x We can see that a0 (x) = a01 (x). b(x) = x2 + 2x − 1 Example 3 – Not a book problem Example Obtain a general solution to the equation dy = x2 + 2x − 1 − 2xy (x2 + 1) dx Solution First, we recognize that the equation is linear and write it in the linear ODE form (x2 + 1) dy + 2xy = x2 + 2x − 1 dx We recognize that a1 (x) = x2 + 1 a0 (x) = 2x We can see that a0 (x) = a01 (x). b(x) = x2 + 2x − 1 Example 3 – Not a book problem Solution We rewrite the left-hand side as d [(x2 + 1)y] = x2 + 2x − 1 dx Check! Example 3 – Not a book problem Solution We rewrite the left-hand side as d [(x2 + 1)y] = x2 + 2x − 1 dx Check! Integrating both sides with respect to x, we have Z d [(x2 + 1)y] dx = dx Z x2 + 2x − 1 dx Example 3 – Not a book problem Solution We rewrite the left-hand side as d [(x2 + 1)y] = x2 + 2x − 1 dx Check! Integrating both sides with respect to x, we have Z d [(x2 + 1)y] dx = dx Z x2 + 2x − 1 dx We obtain and implicit solutition (x2 + 1)y = x3 + x2 − x + C 3 Example 3 – Not a book problem Solution We rewrite the left-hand side as d [(x2 + 1)y] = x2 + 2x − 1 dx Check! Integrating both sides with respect to x, we have Z d [(x2 + 1)y] dx = dx Z x2 + 2x − 1 dx We obtain and implicit solutition (x2 + 1)y = x3 + x2 − x + C 3 To obtain an explicit solution, we divide both sides by x2 + 1: 1 y= 2 x +1 ! x3 + x2 − x + C . 3 Solving first order linear equations Case 3. However, the requirement a0 (x) = a01 (x) is very restrictive and in most cases is not satisfied. To force the requirement to be satisfied, we multiply with an appropriate function µ(x) Definition Solving first order linear equations Case 3. However, the requirement a0 (x) = a01 (x) is very restrictive and in most cases is not satisfied. To force the requirement to be satisfied, we multiply with an appropriate function µ(x) Definition µ(x) is called an integrating factor. Solving first order linear equations Case 3. However, the requirement a0 (x) = a01 (x) is very restrictive and in most cases is not satisfied. To force the requirement to be satisfied, we multiply with an appropriate function µ(x) Definition µ(x) is called an integrating factor. To carry the procedure, we first divide both sides by a1 (x), so that the linear ODE becomes: dy a0 (x) b(x) + y= dx a1 (x) a1 (x) Solving first order linear equations Case 3. However, the requirement a0 (x) = a01 (x) is very restrictive and in most cases is not satisfied. To force the requirement to be satisfied, we multiply with an appropriate function µ(x) Definition µ(x) is called an integrating factor. To carry the procedure, we first divide both sides by a1 (x), so that the linear ODE becomes: dy a0 (x) b(x) + y= dx a1 (x) a1 (x) Which can also be written as dy a0 (x) b(x) + P (x)y = Q(x), where P (x) = and Q(x) = dx a1 (x) a1 (x) Solving first order linear equations Case 3. However, the requirement a0 (x) = a01 (x) is very restrictive and in most cases is not satisfied. To force the requirement to be satisfied, we multiply with an appropriate function µ(x) Definition µ(x) is called an integrating factor. To carry the procedure, we first divide both sides by a1 (x), so that the linear ODE becomes: dy a0 (x) b(x) + y= dx a1 (x) a1 (x) Which can also be written as dy a0 (x) b(x) + P (x)y = Q(x), where P (x) = and Q(x) = dx a1 (x) a1 (x) Definition The equation dy + P (x)y = Q(x) dx is called standard form of linear first order ODE (1). Solving linear equations Solving linear equations Put the equation in standard form. Solving linear equations Solving linear equations Put the equation in standard form. Multiply both sides by µ(x): µ(x) dy + µ(x)P (x)y = µ(x)Q(x) dx Solving linear equations Solving linear equations Put the equation in standard form. Multiply both sides by µ(x): µ(x) dy + µ(x)P (x)y = µ(x)Q(x) dx For the condition a0 (x) = a01 (x) to be satisfied, we need Solving linear equations Solving linear equations Put the equation in standard form. Multiply both sides by µ(x): µ(x) dy + µ(x)P (x)y = µ(x)Q(x) dx For the condition a0 (x) = a01 (x) to be satisfied, we need µ(x)P (x) = µ0 (x) Solving linear equations Solving linear equations Put the equation in standard form. Multiply both sides by µ(x): µ(x) dy + µ(x)P (x)y = µ(x)Q(x) dx For the condition a0 (x) = a01 (x) to be satisfied, we need µ(x)P (x) = µ0 (x) This is a separable equation for µ which we can solve. Solving linear equations Solving linear equations Put the equation in standard form. Multiply both sides by µ(x): µ(x) dy + µ(x)P (x)y = µ(x)Q(x) dx For the condition a0 (x) = a01 (x) to be satisfied, we need µ(x)P (x) = µ0 (x) This is a separable equation for µ which we can solve. (Separate variables, integrate both sides, and solve for µ(x)): Solving linear equations Solving linear equations Put the equation in standard form. Multiply both sides by µ(x): µ(x) dy + µ(x)P (x)y = µ(x)Q(x) dx For the condition a0 (x) = a01 (x) to be satisfied, we need µ(x)P (x) = µ0 (x) This is a separable equation for µ which we can solve. (Separate variables, integrate both sides, and solve for µ(x)): µ(x) = e R P (x) dx Solving linear equations Solving linear equations Put the equation in standard form. Multiply both sides by µ(x): µ(x) dy + µ(x)P (x)y = µ(x)Q(x) dx For the condition a0 (x) = a01 (x) to be satisfied, we need µ(x)P (x) = µ0 (x) This is a separable equation for µ which we can solve. (Separate variables, integrate both sides, and solve for µ(x)): µ(x) = e R P (x) dx We do not use an arbitrary constant here because we only need ONE function µ and we may take C = 0 Solving linear equations Solving linear equations Multiplying both sides of the given linear ODE in standard form by µ(x) we get d [µ(x)y] = µ(x)Q(x) dx Solving linear equations Solving linear equations Multiplying both sides of the given linear ODE in standard form by µ(x) we get d [µ(x)y] = µ(x)Q(x) dx Integrating both sides with respect to x, we have Z µ(x)y = µ(x)Q(x) dx + C Solving linear equations Solving linear equations Multiplying both sides of the given linear ODE in standard form by µ(x) we get d [µ(x)y] = µ(x)Q(x) dx Integrating both sides with respect to x, we have Z µ(x)y = µ(x)Q(x) dx + C Here, we add the arbitrary constant because we want ALL solutions. (The constant must be added in this step.) Solving linear equations Solving linear equations Multiplying both sides of the given linear ODE in standard form by µ(x) we get d [µ(x)y] = µ(x)Q(x) dx Integrating both sides with respect to x, we have Z µ(x)y = µ(x)Q(x) dx + C Here, we add the arbitrary constant because we want ALL solutions. (The constant must be added in this step.) Dividing both sides by µ(x), we obtain an explicit solution y(x) = 1 µ(x) Z µ(x)Q(x) dx + C Example 4 – Problem #8/p.54 Example Solve the equation dy y = + 2x + 1 dx x Example 4 – Problem #8/p.54 Example Solve the equation dy y = + 2x + 1 dx x Solution As a first step we put the equation in standard form: dy 1 − y = 2x + 1. dx x Example 4 – Problem #8/p.54 Example Solve the equation dy y = + 2x + 1 dx x Solution As a first step we put the equation in standard form: dy 1 − y = 2x + 1. dx x Now we easily see that the equation is linear P (x) = − 1 x Q(x) = 2x + 1. Example 4 – Problem #8/p.54 Example Solve the equation dy y = + 2x + 1 dx x Solution As a first step we put the equation in standard form: dy 1 − y = 2x + 1. dx x Now we easily see that the equation is linear P (x) = − 1 x We compute the integrating factor Q(x) = 2x + 1. Example 4 – Problem #8/p.54 Example Solve the equation dy y = + 2x + 1 dx x Solution As a first step we put the equation in standard form: dy 1 − y = 2x + 1. dx x Now we easily see that the equation is linear P (x) = − 1 x Q(x) = 2x + 1. We compute the integrating factor R R µ(x) = e P (x)dx = e = e− ln x = eln x −1 1 −x dx = 1 x Example 4 – Problem #8/p.54 Solution ODE in standard form : 1 dy − y = 2x + 1. dx x Example 4 – Problem #8/p.54 Solution 1 dy − y = 2x + 1. dx x We multiply the linear ODE in standard form by µ(x) = x1 : ODE in standard form : Example 4 – Problem #8/p.54 Solution 1 dy − y = 2x + 1. dx x We multiply the linear ODE in standard form by µ(x) = x1 : ODE in standard form : 1 1 dy 1 − y =2+ x dx x2 x Example 4 – Problem #8/p.54 Solution 1 dy − y = 2x + 1. dx x We multiply the linear ODE in standard form by µ(x) = x1 : ODE in standard form : 1 1 dy 1 − y =2+ x dx x2 x d 1 1 We rewrite the left hand side as: y =2+ dx x x Example 4 – Problem #8/p.54 Solution 1 dy − y = 2x + 1. dx x We multiply the linear ODE in standard form by µ(x) = x1 : ODE in standard form : 1 1 dy 1 − y =2+ x dx x2 x d 1 1 We rewrite the left hand side as: y =2+ dx x x We integrate both sides Z Z d 1 1 y dx = 2+ dx + C dx x x Example 4 – Problem #8/p.54 Solution 1 dy − y = 2x + 1. dx x We multiply the linear ODE in standard form by µ(x) = x1 : ODE in standard form : 1 1 dy 1 − y =2+ x dx x2 x d 1 1 We rewrite the left hand side as: y =2+ dx x x We integrate both sides Z Z d 1 1 y dx = 2+ dx + C dx x x We obtain: 1 y = 2x + ln |x| + C (We want ALL solutions). x Example 4 – Problem #8/p.54 Solution 1 dy − y = 2x + 1. dx x We multiply the linear ODE in standard form by µ(x) = x1 : ODE in standard form : 1 1 dy 1 − y =2+ x dx x2 x d 1 1 We rewrite the left hand side as: y =2+ dx x x We integrate both sides Z Z d 1 1 y dx = 2+ dx + C dx x x 1 y = 2x + ln |x| + C (We want ALL solutions). x We obtain an explicit solution We obtain: y(x) = x (2x + ln |x| + C) = 2x2 + x ln |x| + Cx Example 5 – Problem #9/p.54 Example Solve the equation dr + r tan θ = sec θ dθ Example 5 – Problem #9/p.54 Example Solve the equation dr + r tan θ = sec θ dθ Solution The dependent variable is r; the independent variable is θ. Example 5 – Problem #9/p.54 Example Solve the equation dr + r tan θ = sec θ dθ Solution The dependent variable is r; the independent variable is θ. The equation is already in standard form. Example 5 – Problem #9/p.54 Example Solve the equation dr + r tan θ = sec θ dθ Solution The dependent variable is r; the independent variable is θ. The equation is already in standard form. P (θ) = tan θ and Q(θ) = sec θ Example 5 – Problem #9/p.54 Example Solve the equation dr + r tan θ = sec θ dθ Solution The dependent variable is r; the independent variable is θ. The equation is already in standard form. P (θ) = tan θ and Q(θ) = sec θ The integrating factor is given by µ(θ) = e R P (θ)dθ . Example 5 – Problem #9/p.54 Example dr + r tan θ = sec θ dθ Solve the equation Solution The dependent variable is r; the independent variable is θ. The equation is already in standard form. P (θ) = tan θ and Q(θ) = sec θ The integrating factor is given by µ(θ) = e R µ(θ) = e tan θdθ R = e− ln | cos θ| = eln |cosθ| P (θ)dθ −1 = . Hence, 1 cos θ Example 5 – Problem #9/p.54 Example dr + r tan θ = sec θ dθ Solve the equation Solution The dependent variable is r; the independent variable is θ. The equation is already in standard form. P (θ) = tan θ and Q(θ) = sec θ The integrating factor is given by µ(θ) = e R µ(θ) = e tan θdθ R = e− ln | cos θ| = eln |cosθ| P (θ)dθ −1 = . Hence, 1 cos θ We have dropped the absolute value because we are looking for solution where cos θ > 0. cos θ cannot be zero or less than zero because then µ will not exist. Example 5 – Problem #9/p.54 Solution We multiply both sides by µ(θ) = 1 cos θ : 1 dr 1 +r tan θ = sec2 θ cos θ dθ cos θ Example 5 – Problem #9/p.54 Solution We multiply both sides by µ(θ) = 1 cos θ : 1 dr 1 +r tan θ = sec2 θ cos θ dθ cos θ Hence, the left-hand side can be written as d 1 r = sec2 θ dθ cos θ Example 5 – Problem #9/p.54 Solution We multiply both sides by µ(θ) = 1 cos θ : 1 dr 1 +r tan θ = sec2 θ cos θ dθ cos θ Hence, the left-hand side can be written as d 1 r = sec2 θ dθ cos θ We integrate both sides, recalling that sec θ = 1/ cos θ Z Z 1 r dθ = sec2 θdθ cos θ Example 5 – Problem #9/p.54 Solution We multiply both sides by µ(θ) = 1 cos θ : 1 dr 1 +r tan θ = sec2 θ cos θ dθ cos θ Hence, the left-hand side can be written as d 1 r = sec2 θ dθ cos θ We integrate both sides, recalling that sec θ = 1/ cos θ Z Z 1 r dθ = sec2 θdθ cos θ Using the Table of Integrals in the back of the book, we get 1 r = tan θ + C cos θ Example 5 – Problem #9/p.54 Solution We multiply both sides by µ(θ) = 1 cos θ : 1 dr 1 +r tan θ = sec2 θ cos θ dθ cos θ Hence, the left-hand side can be written as d 1 r = sec2 θ dθ cos θ We integrate both sides, recalling that sec θ = 1/ cos θ Z Z 1 r dθ = sec2 θdθ cos θ Using the Table of Integrals in the back of the book, we get 1 r = tan θ + C cos θ The explicit solution then is: r(θ) = sin θ + C cos θ Example 6 – Problem #14/p.54 Example Solve the equation x sin x dy + 3(y + x2 ) = dx x Solution We first express the equation in standard form Example 6 – Problem #14/p.54 Example Solve the equation x sin x dy + 3(y + x2 ) = dx x Solution We first express the equation in standard form (divide both sides by x and then subtract 3x from both sides). Example 6 – Problem #14/p.54 Example Solve the equation x sin x dy + 3(y + x2 ) = dx x Solution We first express the equation in standard form (divide both sides by x and then subtract 3x from both sides). dy 3 sin x + y = 2 − 3x dx x x Example 6 – Problem #14/p.54 Example Solve the equation x sin x dy + 3(y + x2 ) = dx x Solution We first express the equation in standard form (divide both sides by x and then subtract 3x from both sides). dy 3 sin x + y = 2 − 3x dx x x Thus, we have P (x) = 3 x Q(θ) = sin x − 3x x2 Example 6 – Problem #14/p.54 Example Solve the equation x sin x dy + 3(y + x2 ) = dx x Solution We first express the equation in standard form (divide both sides by x and then subtract 3x from both sides). dy 3 sin x + y = 2 − 3x dx x x Thus, we have The integrating factor P (x) = 3 x µ(x) = e Q(θ) = R P (x)dx sin x − 3x x2 Example 6 – Problem #14/p.54 Example Solve the equation x sin x dy + 3(y + x2 ) = dx x Solution We first express the equation in standard form (divide both sides by x and then subtract 3x from both sides). dy 3 sin x + y = 2 − 3x dx x x Thus, we have P (x) = The integrating factor Hence, R µ(x) = e 3 x µ(x) = e 3 dx x Q(θ) = R sin x − 3x x2 P (x)dx 3 = e3 ln x = eln x = x3 Example 6 – Problem #14/p.54 Example Solve the equation x sin x dy + 3(y + x2 ) = dx x Solution We first express the equation in standard form (divide both sides by x and then subtract 3x from both sides). dy 3 sin x + y = 2 − 3x dx x x Thus, we have P (x) = The integrating factor Hence, R µ(x) = e 3 x µ(x) = e 3 dx x Q(θ) = R sin x − 3x x2 P (x)dx 3 = e3 ln x = eln x = x3 We have dropped the absolute value because we are looking for solution where x > 0. Example 6 – Problem #14/p.54 Solution We multiply both sides by µ(x) = x3 : Example 6 – Problem #14/p.54 Solution We multiply both sides by µ(x) = x3 : x3 dy + 3x2 y = x sin x − 3x4 dx Example 6 – Problem #14/p.54 Solution We multiply both sides by µ(x) = x3 : x3 dy + 3x2 y = x sin x − 3x4 dx Hence, the left-hand side can be written as d 3 x y = x sin x − 3x4 dx Example 6 – Problem #14/p.54 Solution We multiply both sides by µ(x) = x3 : x3 dy + 3x2 y = x sin x − 3x4 dx Hence, the left-hand side can be written as d 3 x y = x sin x − 3x4 dx Z Z d We integrate both sides: x3 y dx = (x sin x − 3x4 )dx dx Example 6 – Problem #14/p.54 Solution We multiply both sides by µ(x) = x3 : x3 dy + 3x2 y = x sin x − 3x4 dx Hence, the left-hand side can be written as d 3 x y = x sin x − 3x4 dx Z Z d We integrate both sides: x3 y dx = (x sin x − 3x4 )dx dx R Using the Table of Integrals in the back of the book for x sin xdx, we get 3 x3 y = sin x − x cos x − x5 + C 5 Example 6 – Problem #14/p.54 Solution We multiply both sides by µ(x) = x3 : x3 dy + 3x2 y = x sin x − 3x4 dx Hence, the left-hand side can be written as d 3 x y = x sin x − 3x4 dx Z Z d We integrate both sides: x3 y dx = (x sin x − 3x4 )dx dx R Using the Table of Integrals in the back of the book for x sin xdx, we get 3 x3 y = sin x − x cos x − x5 + C 5 3 We divide both sides by x to obtain the explicit solution: y(x) = sin x − x cos x 3 2 C − x + 3 3 x 5 x Initial Value Problems When we solve IVPs of the form ( y 0 = f (x, y) y(x0 ) = y0 Initial Value Problems When we solve IVPs of the form ( y 0 = f (x, y) y(x0 ) = y0 We first solve the ODE and obtain a one-parameter family of solutions (or general solution). Initial Value Problems When we solve IVPs of the form ( y 0 = f (x, y) y(x0 ) = y0 We first solve the ODE and obtain a one-parameter family of solutions (or general solution). We use the initial condition to determine the unknown constant. Initial Value Problems When we solve IVPs of the form ( y 0 = f (x, y) y(x0 ) = y0 We first solve the ODE and obtain a one-parameter family of solutions (or general solution). We use the initial condition to determine the unknown constant. It is easier to do that if we use the initial condition to determine the unknown constant with the implicit form of the solution as obtain from the method of separation of variables. Initial Value Problems When we solve IVPs of the form ( y 0 = f (x, y) y(x0 ) = y0 We first solve the ODE and obtain a one-parameter family of solutions (or general solution). We use the initial condition to determine the unknown constant. It is easier to do that if we use the initial condition to determine the unknown constant with the implicit form of the solution as obtain from the method of separation of variables. We demonstrate this in the following examples. Example 7 – Problem#17/p.54 Example Solve the following initial value problem (IVP) ( dy − x1 y = xex y(1) = e − 1 dx Example 7 – Problem#17/p.54 Example Solve the following initial value problem (IVP) ( dy − x1 y = xex y(1) = e − 1 dx Solution The equation is already in standard form. We have P (x) = − 1 x Q(x) = xex Example 7 – Problem#17/p.54 Example Solve the following initial value problem (IVP) ( dy − x1 y = xex y(1) = e − 1 dx Solution The equation is already in standard form. We have P (x) = − 1 x The integrating factor µ(x) is: Q(x) = xex µ(x) = e− R P (x)dx Example 7 – Problem#17/p.54 Example Solve the following initial value problem (IVP) ( dy − x1 y = xex y(1) = e − 1 dx Solution The equation is already in standard form. We have P (x) = − 1 x The integrating factor µ(x) is: µ(x) = e− R 1 x dx Q(x) = xex µ(x) = e− R −1 = e− ln x = eln x P (x)dx = 1 x Example 7 – Problem#17/p.54 Solution We multiply both sides of the linear equation by µ(x) = x1 : Example 7 – Problem#17/p.54 Solution We multiply both sides of the linear equation by µ(x) = x1 : 1 dy y − = ex x dx x2 Example 7 – Problem#17/p.54 Solution We multiply both sides of the linear equation by µ(x) = x1 : 1 dy y − = ex x dx x2 We rewrite the left-hand side as a derivative of a product: d dx 1 y = ex x Example 7 – Problem#17/p.54 Solution We multiply both sides of the linear equation by µ(x) = x1 : 1 dy y − = ex x dx x2 We rewrite the left-hand side as a derivative of a product: d dx 1 y = ex x We integrate both sides. Z d dx 1 y dx = x Z ex dx Example 7 – Problem#17/p.54 Solution We multiply both sides of the linear equation by µ(x) = x1 : 1 dy y − = ex x dx x2 We rewrite the left-hand side as a derivative of a product: d dx 1 y = ex x We integrate both sides. Z d dx 1 y dx = x Z ex dx In the left-hand side, we have derivative after integral 1 y = ex + C x Example 7 – Problem#17/p.46 Solution Next we use the initial condition to evaluate C. We have x = 1, y = e − 1. Example 7 – Problem#17/p.46 Solution Next we use the initial condition to evaluate C. We have x = 1, y = e − 1. Substituting in the implicit solution we get e−1=e+C Hence, −1 = C Example 7 – Problem#17/p.46 Solution Next we use the initial condition to evaluate C. We have x = 1, y = e − 1. Substituting in the implicit solution we get e−1=e+C Hence, −1 = C Finally, the unique solution is 1 y = ex − 1 x Example 7 – Problem#17/p.46 Solution Next we use the initial condition to evaluate C. We have x = 1, y = e − 1. Substituting in the implicit solution we get e−1=e+C Hence, −1 = C Finally, the unique solution is 1 y = ex − 1 x We may also obtain the explicit solution: y = x(ex − 1) Example 8 – Problem#22/p.54 Example Solve the following initial value problem (IVP) ( dy + cos xy = x sin x sin x dx π y( 2 ) = 2 Example 8 – Problem#22/p.54 Example Solve the following initial value problem (IVP) ( dy + cos xy = x sin x sin x dx π y( 2 ) = 2 Solution The ODE is NOT in standard form BUT a0 (x) = a01 (x). Example 8 – Problem#22/p.54 Example Solve the following initial value problem (IVP) ( dy + cos xy = x sin x sin x dx π y( 2 ) = 2 Solution The ODE is NOT in standard form BUT a0 (x) = a01 (x). We can directly rewrite the left-hand side as a derivative of a product: d [(sin x)y] = x sin x dx Example 8 – Problem#22/p.54 Example Solve the following initial value problem (IVP) ( dy + cos xy = x sin x sin x dx π y( 2 ) = 2 Solution The ODE is NOT in standard form BUT a0 (x) = a01 (x). We can directly rewrite the left-hand side as a derivative of a product: d [(sin x)y] = x sin x dx We integrate both sides. Z d ((sin x)y) dx = dx Z x sin xdx Example 8 – Problem#22/p.46 Solution In the left-hand side, we have derivative after integral. For the right-hand side we use the Table of Integrals to integrate ((sin x)y) = sin x − x cos x + C Example 8 – Problem#22/p.46 Solution In the left-hand side, we have derivative after integral. For the right-hand side we use the Table of Integrals to integrate ((sin x)y) = sin x − x cos x + C Next we evaluate C. From the IC, we have x = π2 , y = 2. Example 8 – Problem#22/p.46 Solution In the left-hand side, we have derivative after integral. For the right-hand side we use the Table of Integrals to integrate ((sin x)y) = sin x − x cos x + C Next we evaluate C. From the IC, we have x = π2 , y = 2. Substituting in the implicit solution we get 2 = 1 + C =⇒ 1 = C Example 8 – Problem#22/p.46 Solution In the left-hand side, we have derivative after integral. For the right-hand side we use the Table of Integrals to integrate ((sin x)y) = sin x − x cos x + C Next we evaluate C. From the IC, we have x = π2 , y = 2. Substituting in the implicit solution we get 2 = 1 + C =⇒ 1 = C Finally, the unique solution is (sin x)y = sin x − x cos x + 1 Example 8 – Problem#22/p.46 Solution In the left-hand side, we have derivative after integral. For the right-hand side we use the Table of Integrals to integrate ((sin x)y) = sin x − x cos x + C Next we evaluate C. From the IC, we have x = π2 , y = 2. Substituting in the implicit solution we get 2 = 1 + C =⇒ 1 = C Finally, the unique solution is (sin x)y = sin x − x cos x + 1 We may also obtain the explicit solution: y(x) = sin x − x cos x + 1 sin x