# Bernoulli's equation: ### $$\frac{ dy }{ dx } +P(x)y=Q(x)y^n \quad\quad n\in\mathbb{R},\quad n\ne0,1$$ >For now, I'll tag and refer to these as #de_bernoulli. This is in standard form btw. It looks almost like a linear equation! In fact if $n=0$ it is by definition. We will see further that if $n=1$ you get a separable equation. So we ignore the cases when $n=0,1$ as these can be solved with prior tools. Bernoulli's equations are important as you will see it in biology and in engineering. Our goal is to find the general solution to $y$ which is some function of $x$. We should expect one arbitrary constant in our final answer for $y$ since this is a first order differential equation. Notice there's an easy solution! $y(x)=0$ is a trivial solution to any Bernoulli equation. You can verify that by plugging in $y(x)=0$ to the original expression: $\frac{dy}{dx}+0=0\quad \implies \quad0=0$ Now let's find the general solution. Let's move the y to the LHS: $y^{-n}\frac{ dy }{ dx }+P(x)y^{1-n}=Q(x)$ notice that $y(x)=0$ is no longer a solution! It was lost due to dividing by zero. So from here on out we will have to remember to add it back in our final answers. let $y^{1-n}=u$ Differentiating this with respect to $x$ gives us: $(1-n)y^{-n}\frac{ dy }{ dx }=\frac{du}{dx}$ $y^{-n}\frac{ dy }{ dx }=\frac{ du }{ dx }{\frac{1}{1-n}}$ substituting in we get: $y^{-n}\frac{ dy }{ dx }+P(x)u=Q(x)=\frac{ du }{ dx }{\frac{1}{1-n}+P(x)u}$ And that is a linear equation again, which can be solved with prior tools. Here's a handy formula if you wanna solve Bernoulli equations quick: $$\frac{1}{1-n}\frac{ du }{ dx }+P(x)u=Q(x)\quad \Box$$ Just remember that once you find $u(x)$, substitute it back for $y(x)^{1-n}=u(x)$ to get your solution for y, and don't forget to add $y(x)=0$ with your final answer! >Remember when I said that when n=1 the equation becomes a separable equation?: >$y^{-n}\frac{ dy }{ dx }+P(x)y^{1-n}=Q(x)$ >let $n=1$ >$y^{-1}\frac{ dy }{ dx }+P(x)=Q(x)$ >$y^{-1}dy=dx(Q(x)-P(x))$ <-This is indeed a separable equation #de_separable --- # Examples of Bernoulli's equation: #ex #de_bernoulli Find the general solution to: $y'+y=(xy)^2$ Looks like a Bernoulli equation because when we distribute the $^2$ we get $x^2y^2$ on the RHS. This also tells us that n=2 $y'+y=x^2y^2$ $y'y^{-2}+y^{-1}=x^2$ >Note that we lost the $y(x)=0$ solution here, we will have to add it back in the end. let $u=y^{1-n}=y^{-1}$ Differentiating wrt. $x$ we get: $\frac{du}{dx}=-y^{-2}{\frac{dy}{dx}}$ $y^{-2}{\frac{dy}{dx}=-\frac{ du }{ dx }}$ $y^{-2}{\frac{dy}{dx}+y^{-1}=-\frac{ du }{ dx }}+y^{-1}$ ${x^2=-\frac{ du }{ dx }}+y^{-1}$ $x^2=-\frac{du}{dx}+u$ $\frac{du}{dx}-u=-x^2$ Yay we have a linear equation now! We can solve it using the techniques & formulas we learned for them. let $P(x)=-1 \quad Q(x)=-x^2 \qquad I(x)=e^{\int -1 \, dx}=e^{-x}$ $u=-e^{x}\int e^{-x}x^2 \, dx$ How to integrate this? You can use integration by parts: LIATE: log, inv trig, alg, trig, exp $\int fg' \, dx=fg-\int f'g \, dx$ let $f=x^2 \qquad f'=2x \qquad g'=e^{-x} \qquad g=-e^{-x}$ $u=-e^{x}\left( x^2(-e^{-x})-\int 2x(-e^{-x}) \, dx \right)$ $u=-e^{x}\left( -x^2e^{-x}+2\int xe^{-x} \, dx \right)$ let $f=x \qquad f'=1 \qquad g'=e^{-x} \qquad g=-e^{-x}$ $u=-e^x\left( -x^2e^{-x}+2\left( -xe^{-x}-\int -e^{-x} \, dx \right) \right)$ $\frac{1}{y}=-e^x\left( -x^2e^{-x}+2\left( -xe^{-x}-e^{-x} +C\right) \right)$ $\frac{1}{y}=x^2+2(x+1+Ce^x)$ $\frac{1}{y}=x^2+2x+2+Ce^x$ The general solution to the DE is: $$y(x)=\frac{1}{x^2+2x+2+Ce^x} \quad\text{as well as}\quad y(x)=0$$ --- #end of lecture 3