Problem about complex integration The question is to find $\int \frac{z^2-z+1}{z-1}dz$ over $|z|=1$.

My solution is:

Using Cauchy's integral formula we have:

$$f(1) = \frac{1}{2\pi i}\int \frac{f(z)}{z-1}dz,$$ 

but $f(1) = 1$. Therefore:

$$\int \frac{f(z)}{z-1}dz = 2\pi i,$$

where $f(z) = z^2-z+1$. Is my solution correct? If not then please help me to rectify it. Thanks a lot.
Your solution is incorrect because you are using Cauchy's integral formula incorrectly. Using Cauchy's formula we can evaluate the function at any point inside the domain bounded by the contour of integration and in this case, the point lies on the contour.
The correct approach is to find the Principal Value of the integral as pointed out by @MhenniBenghorbal.

Let $C$ denote the unit circle. Note that 
$\int_C \dfrac{z^2-z+1}{z-1}\, \mathrm{d} z = \int_c z \, \mathrm{d} z + \int_C \dfrac{\mathrm{d} z}{z-1} = \int_C \dfrac{\mathrm{d} z}{z-1}$ where the first integral is zero by Cauchy's theorem. Now we find the Principal Value of the second integral. 

$ \mathrm{PV} \int_C \dfrac{\mathrm{d} z}{z-1} = \lim_{\epsilon \rightarrow 0} \left[\int_{C_1} \dfrac{dz}{z-1} + \int_{C_2} \dfrac{dz}{z-1}\right]$. 

Here C is approximated by the boundary of the region given by $\{|z|&lt;1 \}\backslash \{|z-1|&lt;\epsilon \}$ and $C_1$ is the bigger arc while $C_2$ is the arc of radius $\epsilon$. Hence $C_1: z=e^{i\theta}; \epsilon &lt; \theta &lt; 2\pi-\epsilon$ in the counter-clockwise direction and $C_2: z = 1+\epsilon e^{i\phi}; \pi/2 &lt; \phi &lt; 3\pi/2$ in the clockwise direction.

Therefore $ \mathrm{PV} \int_C \dfrac{\mathrm{d} z}{z-1} =2\pi i \times \left( \text{Residue of }1/(z-1) \text{ inside the region bounded by } C_1 \cup C_2 \right) = 0$.

$0 =  \lim_{\epsilon \rightarrow 0} \left[\int_{\epsilon}^{2\pi-\epsilon} \dfrac{ie^{i\theta}d\theta}{e^{i\theta}-1} - \int_{\pi/2}^{3\pi/2}\dfrac{i \epsilon e^{i\phi}d\phi}{\epsilon e^{i\phi}} \right]$,

$\lim_{\epsilon \rightarrow 0} \int_{\epsilon}^{2\pi-\epsilon} \dfrac{ie^{i\theta}d\theta}{e^{i\theta}-1} = i\pi $;  

that is $\int_C \dfrac{dz}{z-1} = i\pi$
If we just take $z=\cos x+i\sin x$ and solve the question and instead of $dz$ we make i

Is that "i" an "integral" which was cut off or an $i$, imaginary unit?