Finding $g(x)$ given $g(x)= \displaystyle\int_0^1e^{x+t}g(t) dt +x $ 
$$g(x)= \displaystyle\int_0^1e^{x+t}g(t) dt +x $$

How do I find $g(x)$ from the above functional equation? 
Attempt(s): 


*

*$\dfrac{g(x)-x}{e^x}= \displaystyle\int_0^1 e^t g(t)dt$

*Differentiated  to get $g'(x)+x = g(x)+1$ and double differentiated to get $g''(x)+1 = g'(x)$

*Wrote g(-x) and added to get $g(x)+g(-x)$ to see if anything useful canbe extracted.

*Tried integration by parts. 


Answer is: 

 $g(x)= \left(\dfrac{2}{3-e^2}\right)e^x + x$

 A: hint
The solution of the differential equation
$$y'+x=y+1$$ satisfied by $g$ is
$$x+\lambda e^x$$
with
$$\lambda=\int_0^1(x+\lambda e^x)e^xdx$$
$$=1+\frac{\lambda}{2}(e^2-1)$$
thus
$$g(x)=x+\frac{2e^x}{(3-e^2)}$$
A: Let $A:=\displaystyle \int_0^1\,\exp(t)\,g(t)\,\text{d}t$.  Then, the problem statement says that
$$g(x)=A\,\exp(x)+x\text{ for all }x\in\mathbb{R}\,.$$
Thus,
$$\begin{align}
A&=\int_0^1\,\exp(t)\,g(t)\,\text{d}t=\int_0^1\,\exp(t)\,\big(A\,\exp(t)+t\big)\,\text{d}t
\\
&=A\,\int_0^1\,\exp(2t)\,\text{d}t+\int_0^1\,t\,\exp(t)\,\text{d}t
\\
&=\frac{A}{2}\,\big(\exp(2t)\big)\Big|^{t=1}_{t=0}+\Biggl(\big(t\,\exp(t)\big)\Big|_{t=0}^{t=1}-\int_0^1\,\exp(t)\,\text{d}t\Biggr)
\\
&=\frac{A}{2}\,\left(\text{e}^2-1\right)+\Biggl(\text{e}-\big(\exp(t)\big)\Big|^{t=1}_{t=0}\Biggr)=\frac{A}{2}\,\left(\text{e}^2-1\right)+\big(\text{e}-(\text{e}-1)\big)
\\&=\frac{A}{2}\,\left(\text{e}^2-1\right)+1\,.
\end{align}$$
This shows that
$$A=-\frac{2}{\text{e}^2-3}\,,$$
whence
$$g(x)=-\frac{2\,\exp(x)}{\text{e}^2-3}+x\text{ for all }x\in\mathbb{R}\,,$$
which coincides with the answer key.
A: You have came to the point where you got:
$$g'(x)-g(x)=1-x$$
This is a good news, you can solve differential equations of this form quite easily. Observing the LHS, you see that it's the (algebraic) sum of a derivative of the function, and the function itself, similar to the form obtained when you differentiate the multiplication of two functions. But how do you modify this equation to get such a result? The answer is integrating factor, which in this case is:
$$I.F = e^{\int{-1dx}}$$
$$I.F = e^{-x}$$
Multiply the IF on both sides of the equation:
$$e^{-x}g'(x) - e^{-x}g(x) = e^{-x}(1-x)$$
You can see this conveniently becomes
$$\frac{d}{dx}\{e^{-x}g(x)\} = e^{-x}(1-x)$$
Hopefully you can take it from here.
A: For the differential equation 
$$g'(x)+x = g(x)+1$$
Rewrite it as
$$g'(x)-1 = g(x)-x$$
$$(g(x)-x)' = g(x)-x$$
$$\int \frac {d(g(x)-x)}{ g(x)-x}=\int dx=x+K$$
$$\ln |g(x)-x|=x+K \implies g(x)=Ke^x+x$$
A: There is no need to differentiate.
$$\frac{g(x)-x}{e^x}=\displaystyle\int_0^1e^{t}g(t) dt =C$$
Because the defined integral isn't function of $x$.
$$g(x)=x+Ce^x$$
$C=\displaystyle\int_0^1e^{t}\left(t+Ce^t \right) dt = \frac{e^2-1}{2}C+1\quad$ gives $\quad C=\frac{2}{3-e^2}$
$$g(x)=x+\frac{2e^x}{3-e^2}$$
