I am trying to understand the basics of calculus of variations. To that effect I am trying to solve a problem stated as follows:
Find an extremal for $$I(y) = \int^1_0y'^2 - y^2 + 2xy dx$$
So I calculated:
\begin{align*} \frac{\partial F}{\partial y'} &= 2y' \implies \frac{d}{dx}\bigg(\frac{\partial F}{\partial y'}\bigg) = 2y'' \\ \frac{\partial F}{\partial y} &= -2y + 2x \end{align*}
Which gives the Euler equation $2y'' +2y - 2x = 0$ (I think, unless I messed up my math).
Ok now I need to try to find solutions to this differential equation, however, I only know how to solve linear second order DE's. The $x$ term is throwing me off and I am not sure how to solve this.
I know $y(x) = x$ is a solution by inspection, but inspection is a poor man's approach to solving DE's.
As you found already a particular solution, by inspection or intuitive application of the method of undetermined coefficients, you only need the complementary solution of the homogeneous equation to get the general solution as sum of both.
You are looking for solutions satisfying the boundary conditions $y'(0)= y'(1)=0$, as $$\begin{align} I(y+\varepsilon v) &= \int^1_0[y'^2+2εy'v' - y^2-2εyv + 2xy+2εxv+O(ε^2)]\, dx \\ &=I(y)+2ε\bigl[y'v\bigr]_0^1+2ε\int^1_0[-y''-y+x]v\,dx+O(ε^2). \end{align}$$ So to get the first-order terms to zero under free variation of $v$, the values of $y'$ at the boundary need to be zero.