Let $f,g \in \mathbb{R}[x]$ , $f(x)+g(x)=5$ and $f(g(x))=8-4x $ find $g(2)$

As you noticed both $f$ and $g$ have to be of the form $a_0+a_1x$ and so lets set $g(x)=a_0+a_1x$. From the equations above:

$f(x)=5-a_0-a_1x$

$5-a_0-a_1(a_0+a_1x)=8-4x \iff a_0+a_0a_1+a_1^2x=-3+4x$

and so from the second equation $a_0+a_0a_1=-3$ and $a_1^2=4$, because "two polynomials are considered equal if they have equal coefficients of corresponding powers of the independent variable".

Can you proceed from here?


hint

$$f(g(x))=8-4x\implies $$ $$f'(g(x))f'(x)=4$$ because

$$g'(x)=-f'(x)$$

So, necessarily, $ f(X)=aX+b$ with $$a^2=4$$

and $$g(X)=5-aX-b$$

thus $$f(g(x))=a(5-ax-b)+b$$ $$=-a^2x+5a-ab+b=8-4x$$

there are two solutions $$(a,b)\in\{(2,2),(-2,6)\}$$