You can just take [Bob Hanlon](http://mathematica.stackexchange.com/users/9362/bob-hanlon)'s [answer][1] from 2006 directly, and modify the plot just a bit to update it. ChebyshevApprox[n_Integer?Positive, f_Function, x_] := Module[{c, xk}, xk = Pi (Range[n] - 1/2)/n; c[j_] = 2*Total[Cos[j*xk]*(f /@ Cos[xk])]/n; Total[Table[c[k]*ChebyshevT[k, x], {k, 0, n - 1}]] - c[0]/2]; f = 3*#^2*Exp[-2*#]*Sin[2 #*Pi] &; ChebyshevApprox[3, f, x] // Simplify ((-(3/4))*((-E^(2*Sqrt[3]))*(Sqrt[3] - 2*x) - 2*x - Sqrt[3])*x* Sin[Sqrt[3]*Pi])/E^Sqrt[3] GraphicsGrid[ Partition[ Table[Plot[{f[x], ChebyshevApprox[n, f, x]}, {x, -1, 1}, Frame -> True, Axes -> False, PlotStyle -> {Blue, Red}, PlotRange -> {-2, 10}, Epilog -> Text["n = " <> ToString[n], {0.25, 5}]], {n, 9}], 3], ImageSize -> 500] [![enter image description here][2]][2] [1]: http://forums.wolfram.com/mathgroup/archive/2006/Aug/msg00165.html [2]: https://i.sstatic.net/1yGlm.png