Lời giải:
Ta có: \(a^2+b^2-2ab=(a-b)^2\geq 0\Rightarrow a^2+b^2\geq 2ab\)
\(\Rightarrow 2(a^2+b^2)\geq (a+b)^2\)
Mà \(a^2+b^2=a+b\Rightarrow 2(a+b)\geq (a+b)^2\)
\(\Rightarrow a+b\leq 2\)
Lại có:
\(S=\frac{a}{a+1}+\frac{b}{b+1}=1-\frac{1}{a+1}+1-\frac{1}{b+1}\)
\(=2-\left(\frac{1}{a+1}+\frac{1}{b+1}\right)\)
Áp dụng BĐT Svac-sơ:
\(\frac{1}{a+1}+\frac{1}{b+1}\geq \frac{4}{a+1+b+1}=\frac{4}{a+b+2}\geq \frac{4}{4}=1\) (do \(a+b\leq 2\) )
Do đó:
\(S=2-\left(\frac{1}{a+1}+\frac{1}{b+1}\right)\leq 2-1=1\)
Vậy \(S_{\max}=1\Leftrightarrow a=b=1\)