To evaluate the integrals \( \int x \log(1+x) \, dx \) and \( \int x \log^2 x \, dx \), we will use integration by parts.
### Part (i): Evaluate \( \int x \log(1+x) \, dx \)
1. **Choose \( u \) and \( dv \)**:
- Let \( u = \log(1+x) \) and \( dv = x \, dx \).
- Then, we differentiate and integrate:
- \( du = \frac{1}{1+x} \, dx \)
- \( v = \frac{x^2}{2} \)
2. **Apply Integration by Parts**:
\[
\int u \, dv = uv - \int v \, du
\]
Substituting the values:
\[
\int x \log(1+x) \, dx = \frac{x^2}{2} \log(1+x) - \int \frac{x^2}{2} \cdot \frac{1}{1+x} \, dx
\]
3. **Simplify the Integral**:
\[
\int \frac{x^2}{2(1+x)} \, dx = \frac{1}{2} \int \frac{x^2}{1+x} \, dx
\]
We can simplify \( \frac{x^2}{1+x} \) as:
\[
\frac{x^2}{1+x} = x - \frac{x}{1+x}
\]
Therefore,
\[
\int \frac{x^2}{1+x} \, dx = \int x \, dx - \int \frac{x}{1+x} \, dx
\]
The first integral is:
\[
\int x \, dx = \frac{x^2}{2}
\]
The second integral can be solved by substitution:
\[
\int \frac{x}{1+x} \, dx = \int \left(1 - \frac{1}{1+x}\right) \, dx = x - \log(1+x)
\]
4. **Combine the Results**:
Putting everything together:
\[
\int x \log(1+x) \, dx = \frac{x^2}{2} \log(1+x) - \frac{1}{2} \left( \frac{x^2}{2} - (x - \log(1+x)) \right)
\]
Simplifying gives:
\[
= \frac{x^2}{2} \log(1+x) - \frac{x^2}{4} + \frac{x}{2} - \frac{1}{2} \log(1+x)
\]
### Final Result for Part (i):
\[
\int x \log(1+x) \, dx = \frac{x^2}{2} \log(1+x) - \frac{x^2}{4} + \frac{x}{2} - \frac{1}{2} \log(1+x) + C
\]
---
### Part (ii): Evaluate \( \int x \log^2 x \, dx \)
1. **Choose \( u \) and \( dv \)**:
- Let \( u = \log^2 x \) and \( dv = x \, dx \).
- Then, we differentiate and integrate:
- \( du = 2 \log x \cdot \frac{1}{x} \, dx = \frac{2 \log x}{x} \, dx \)
- \( v = \frac{x^2}{2} \)
2. **Apply Integration by Parts**:
\[
\int u \, dv = uv - \int v \, du
\]
Substituting the values:
\[
\int x \log^2 x \, dx = \frac{x^2}{2} \log^2 x - \int \frac{x^2}{2} \cdot \frac{2 \log x}{x} \, dx
\]
This simplifies to:
\[
= \frac{x^2}{2} \log^2 x - \int x \log x \, dx
\]
3. **Evaluate \( \int x \log x \, dx \)**:
Using integration by parts again:
- Let \( u = \log x \) and \( dv = x \, dx \).
- Then, \( du = \frac{1}{x} \, dx \) and \( v = \frac{x^2}{2} \).
\[
\int x \log x \, dx = \frac{x^2}{2} \log x - \int \frac{x^2}{2} \cdot \frac{1}{x} \, dx = \frac{x^2}{2} \log x - \frac{1}{2} \int x \, dx
\]
\[
= \frac{x^2}{2} \log x - \frac{x^2}{4}
\]
4. **Combine the Results**:
Substituting back gives:
\[
\int x \log^2 x \, dx = \frac{x^2}{2} \log^2 x - \left( \frac{x^2}{2} \log x - \frac{x^2}{4} \right)
\]
Simplifying:
\[
= \frac{x^2}{2} \log^2 x - \frac{x^2}{2} \log x + \frac{x^2}{4}
\]
### Final Result for Part (ii):
\[
\int x \log^2 x \, dx = \frac{x^2}{2} \log^2 x - \frac{x^2}{2} \log x + \frac{x^2}{4} + C
\]
---