I have a difference equation and I am struggling to find the particular solution for it. $$ y_n-y_{n-1}=n^2 $$ I have already found the yc and I need to find yp to find out the total solution of this difference equation
3 Answers
HINT
Try $y_n = An^3+Bn^2+Cn+D$ and compute the value of $A,B,C,D$ that would fit by plugging in...
UPDATE
Note that $$ \begin{split} y_{n-1} &= A(n-1)^3+B(n-1)^2+C(n-1)+D \\ &= A \left[n^3-3n^2+3n-1\right] + B \left[n^2-2n+1\right] + Cn-C+D \\ &= An^3 + n^2 [B-3A] + n[3A-2B+C] + 1[D-C] \end{split} $$
UPDATE 2
From your comments, you are suggesting that the correct solution has $A=1/3,B=1/2,C=1/6,D=0$, which yields $$y_n = n^3/3 + n^2/2 + n/6.$$
Let's check that is indeed the case. Note that $$ \begin{split} y_{n-1} &= (n-1)^3/3 + (n-1)^2/2+(n-1)/6 \\ &= \frac{n^3-3n^2+3n-1}{3} + \frac{n^2-2n+1}{2} + \frac{n-1}{6} \\ &= \left[\frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6} \right] + n^2\left[\frac{-3}{3}\right] + n \left[ \frac{3}{3} + \frac{-2}{2}\right] + \frac{-1}{3}+\frac{1}{2} - \frac16\\ &= y_n -n^2, \end{split} $$ and therefore $y_n - y_{n-1} = n^2$, as desired. Hence, this is a good solution.

- 54,422
-
why wouldn't it be An^2+Bn+c ??? and how will i comput y[n-1]^2 if it actually makes sence? – tania miah May 14 '19 at 21:30
-
@taniamiah because taking differences of a quadratic polynomial results in a linear one, and you need a quadratic on the RHS. See update on how to proceed – gt6989b May 14 '19 at 21:32
-
i tries your solution and i came out with these values <<please check them A=1/3,,,B=1/2,,C=1/6,,,D=0 – tania miah May 15 '19 at 22:30
-
@taniamiah this is correct. You can also verify this works by plugging it into the original equation. – gt6989b May 15 '19 at 22:50
-
then my results are right??? can you please tell me how can i check my results in matlab ??? – tania miah May 15 '19 at 22:55
-
@taniamiah not sure how to check it matlab, but you can plug them into your original relation – gt6989b May 16 '19 at 00:41
-
and what should i get to know that my answer is correct?? – tania miah May 16 '19 at 01:57
-
@taniamiah see update2 – gt6989b May 16 '19 at 03:46
-
thank you that was helpful and made me make sure that my results are correct ....thanks a lot – tania miah May 16 '19 at 15:33
gt6989b's answer isn't bad, though it is somewhat messy. It's easier to compute it in terms of rising factorials:
\begin{align}y_n&=An^{(3)}+Bn^{(2)}+Cn^{(1)}+Dn^{(0)}\\&=An(n+1)(n+2)+Bn(n+1)+Cn+D\end{align}
We then have
\begin{align}y_n-y_{n-1}&=3An^{(2)}+2Bn^{(1)}+Cn^{(0)}\\&=3An(n+1)+2Bn+C\end{align}
We also have
$$n^2=n^{(2)}-n^{(1)}$$
Thus, $A=\frac13,B=-\frac12,$ and $C=0,$ with $D=y_0$.

- 74,685
-
I tried your answer but when I used mat lab to make sure its correct , my total solution doesn't match with the mat lab results – tania miah May 15 '19 at 14:12
-
i guess there is a problem in the values od the coefficients because when i tried to solve it i came up with different values for b and c ,,,,,these are my results please recheck your results and tell me to make sure of mine (A=1/3,,B=1/2,,C=1/6) @Simply Beautiful Art – tania miah May 15 '19 at 14:48
-
@taniamiah That's definitely wrong, how are you getting that? – Simply Beautiful Art May 15 '19 at 18:47
-
my final equation is 3An^2-3An+2Bn+c=n^2,,,,,thats where i got my coefficients ,,,,did you check matlab results to make sure ???? @SimplyBeautifulArt – tania miah May 15 '19 at 21:51
-
@taniamiah Assuming the $-3An$ was a typo, where are you getting $3An^2+2Bn+C=n^2$? And yes, you can easily verify my answer is correct by plugging in the values and multiplying everything out. – Simply Beautiful Art May 15 '19 at 22:19
-
that means i didn't get your answer yet please can you help me solve it out ???? step by step to figure it out @SimplyBeautifulArt – tania miah May 15 '19 at 22:26
-
It would help me much more if you explained how you got what you got rather than giving me nothing to work on. Each "step" is given in my answer already, so you should be more specific as to where you get lost following my answer. – Simply Beautiful Art May 15 '19 at 22:32
-
okay i will but am sorry i don't know how to write the codes of my equations i am new to till website >>>> – tania miah May 15 '19 at 22:39
-
okay fist since my actual equation is y[n]-y[n-1]=n^2,,,,an my yparticular is an^3+bn^2+cn+d i will find the values of coefficients by substituting yp in my actuall equation like this an^3+bn^2+cn+d-a[n-1]^3-b[n-1]^2-c[n-1]-d=n^2.......then by solving the brackets and finding the values of a b c d does this make sence – tania miah May 15 '19 at 22:47
-
-
-
Then you did not read my answer. The entire point of my answer is to avoid having something like $n^3$ so that we would not have to expand $(n-1)^3$. – Simply Beautiful Art May 15 '19 at 23:15
-
okay at the end shouldn't they both give you the same results <<< I mean the final solution for the values of A B C and D????? – tania miah May 15 '19 at 23:19
-
-
since i solved the question using (the power of 3 ) that you told me to avoid >>my results shoud be the same as yours but they are not .... what is wrong with my answer??? why are my results wrong ?? – tania miah May 15 '19 at 23:25
-
okay my solution is different to yours but why did it give different results >>>did you get what i mean? – tania miah May 15 '19 at 23:27
Note that it is a telescoping relation, thus $\displaystyle y_n-y_0=\sum\limits_{k=1}^n k^2=\dfrac{n(n+1)(2n+1)}6$
At the same time since: why is $\sum\limits_{k=1}^{n} k^m$ a polynomial with degree $m+1$ in $n$
Assuming we don't know $\sum k^2$, we are reduced to find a solution of the form $An^3+Bn^2+Cn+D$ as in the other answers...

- 28,563