What are the beginning steps of solving the definite integral of $\ln(x^2)$ on [-1,1] using Gauss-Legendre quadrature with 4 nodes? What are the beginning steps of solving the definite integral of $\ln(x^2)$ on [-1,1] using Gauss-Legendre quadrature with 4 nodes?($\int_{-1}^1\ln x^2 dx$)
I have seen some videos on how to solve using Gauss Legendre and finding the weights by using linear/quadratic/cubic/etc polynomial approximations, but I am not sure if that is the method you use only for integrals of $f(x)$ where $f(x)$ is in the form of x's alone (i.e. $f(x)=5x-4$) or if this is the method you use also when $x$ is inside another function, like natural log, or sine. Can someone help me by writing out the first few steps to solve this integral using Gauss-Legendre?
 A: I think you may be a bit confused on what Gauss-Legendre quadrature formulas are used for. To clarify, in general, quadrature formulas are used to approximate the numerical value of defined integrals of various form:
$$\int_a^b\omega(x)f(x)dx \approx \sum_{i=1}^nw_if(x_i)$$
where $\omega(x)$ is the weight function, $w_i$ are called weights and $x_i$ nodes. 
The starting idea is to use polynomial interpolation on the function $f$. Since an interpolation formula on $n$ nodes is exact on any polynomial of degree at most $n-1$, to define the precision of a quadrature formula, we watch how it integrates exactly polynomials up to a certain degree on a fixed number of nodes (also note that polynomials are used in interpolation and then referred in quadrature because of their ability in approximating continous functions, which gives a good parameter for valuating precision). 
Gaussian quadrature formulas are a family of quadrature formulas with the highest precision possible $2n-1$ on $n$ nodes. This nodes are the roots of a polynomial obtained as the $n$th-element of a suquence of orthogonal polynomials in $L_{2,\omega}([a,b])$. So giving the interval $[a,b]$ and the weight function $\omega(x)$ you can construct different sequences of orthogonal polynomials to get nodes for the precision you need. Legendre sequence is for the interval $[-1,1]$ and with weight function $\omega(x)=1$:
$$p_0(x)=1, \quad p_1(x)=x$$
$$(n+1)p_{n+1}(x)=(2n+1)xp_n(x)-np_{n-1}(x)$$
So you can calculate $p_4(x)$, find its roots (which are $\pm 0.861136311594053$ and
$\pm 0.339981043584856$). 
The weights (which are $0.347854845137454$ and
$0.652145154862546$ respectively) can be calcuted using the following formula:
$$w_i=\frac{2}{(1-x_i^2)[p_n'(x_i)]^2}$$
and then put all togheter in the formula. This process is identical for every function you want to integrate in $[-1,1]$, doesn't matter the form. The difference is in the error you make by approximation: if the function is a polynomial of degree up to $2n-1$ (so up to degree $7$ in your case) the approximation is exact (excluding the rounding errors in the machine calculations), otherwise the error increases as the function gets worse and worse approximated by polynomials up to degree $2n-1$.
Note that, in your case, the approximation you'll get is quite far from the expected value ($-4$) since the order isn't very high and, most importantly, $ln(x^2)$ has a singularity in $0$, so it isn't continous in $[-1,1]$.
