\(G\left(x\right)=ax+b\)
Ta có:\(G\left(-1\right)=a.\left(-1\right)+b=-a+b=2=>b=a+2\left(1\right)\)
\(G\left(2\right)=a.2+b=2a+b=4\left(2\right)\)
Thay (1) vào (2),ta có:
\(2a+\left(a+2\right)=4\Rightarrow3a+2=4\Rightarrow3a=2\Rightarrow a=\frac{2}{3}\)
\(\Rightarrow b=\frac{2}{3}+2=\frac{8}{3}\)
Vậy a=2/3;b=8/3