Step 1: We use integration by parts. Let \( u = x \) and \( dv = e^x \, dx \). Then, \( du = dx \) and \( v = e^x \).
Step 2: Apply the integration by parts formula: \[ \int u \, dv = uv - \int v \, du \] Substituting the values of \( u \) and \( v \): \[ \int xe^x \, dx = x e^x - \int e^x \, dx. \]
Step 3: Now, integrate \( e^x \): \[ \int e^x \, dx = e^x. \]
Step 4: Thus, the integral is: \[ \int xe^x \, dx = x e^x - e^x + C. \]