For[j=0, j<=5, j++,
  Print["P",j,"(x)=",LegendreP[j,x]] ]

Solve[LegendreP[3,x]==0,x]

Clear[x1,x2,x3];
xx  = {Sqrt[3/5], 0, -Sqrt[3/5]};

Solve[{A1 + A2 + A3 == 2,  
A1 xx[[1]]+A2 xx[[2]]+A3 xx[[3]]== 0,
A1 xx[[1]]^2 + A2 xx[[2]]^2 + 
  A3 xx[[3]]^2 ==2/3}, {A1,A2,A3}]

Clear[A];
A[1]= 5/9; A[2]=8/9; A[3]=5/9;

Gauss3[f_] := Sum[A[k] * f[xx[[k]] ],
   {k,3}];

Clear[g]; g[x_] = x^4;
Gauss3[g]

Clear[A,x];
dP[n_,x_]=D[LegendreP[n,x],x]   ;
A[k_]:= -2 / ((n+1) LegendreP[n+1,xx[[k]]] dP[n,xx[[k]]]) ;

n=3;  A[3]

Solve[LegendreP[4,x]==0,x]

Clear[xx];
xx ={ Sqrt[30 + Sqrt[480]] / Sqrt[70],
   -Sqrt[30 + Sqrt[480]] / Sqrt[70],
   Sqrt[30 - Sqrt[480]] / Sqrt[70],
  - Sqrt[30- Sqrt[480]] / Sqrt[70]};

Clear[A,x];
dP[n_,x_]=D[LegendreP[n,x],x]  ;
A[k_]:= -2/((n+1)LegendreP[n+1,xx[[k]]] dP[n,xx[[k]]]);

Clear[n];
n=4;  A[1] //N

Gauss4[f_] := Sum[A[k] * f[xx[[k]] ] , {k,4}];

diff[m_] := Sum[N[A[k] * xx[[k]]^m,8] , {k,4}] - (1-(-1)^(m+1))/(m+1);

diff[7]

Clear[xx,n,k];
xx[k_] = Cos[ (2k+1) Pi / (2n+2)];
GaussCheb[f_]:=(Pi/(n+1)) Sum[f[xx[k]],
  {k,0,n}];

Clear[n,g];
n=100;
g[x_]= Cos[x];
GaussCheb[g]//N

NIntegrate[g[x] / Sqrt[1-x^2], 
 {x,-1,1}]