Aid in identifying an error made whilst evaluating an integral 
Evaluate $$I=\int\frac{1}{x^2-8x+8}~dx$$

First, complete the square using the denominator: $$x^2-8x+8=(x-4)^2-8$$
and therefore, let $x=2\sqrt{2}\sec{\theta}+4$, $\therefore dx=2\sqrt{2}\sec{\theta}\tan{\theta}~d\theta$, and hence, we have
$$I=2\sqrt{2}\int\frac{\sec{\theta}\tan{\theta}}{(2\sqrt{2}\sec{\theta}+4-4)^2-8}~d\theta$$ $$=2\sqrt{2}\int\frac{\sec{\theta}\tan{\theta}}{(2\sqrt{2}\sec{\theta})^2-8}~d\theta$$
$$=2\sqrt{2}\int\frac{\sec{\theta}\tan{\theta}}{8\sec^2{\theta}-8}~d\theta$$
$$=\frac{\sqrt{2}}{4}\int\frac{\sec{\theta}\tan{\theta}}{\sec^2\theta-1}~d\theta$$
$$=\frac{\sqrt{2}}{4}\int\frac{\sec{\theta}\tan{\theta}}{\tan^2\theta}~d\theta$$
$$=\frac{\sqrt{2}}{4}\int\frac{\sec{\theta}}{\tan\theta}~d\theta$$
note:$$\frac{\sec{\theta}}{\tan{\theta}}=\frac{\cos{\theta}}{\sin{\theta}}\cdot\frac{1}{\cos{\theta}}=\csc{\theta}$$
therefore,
$$I=-\frac{\sqrt{2}}{4}\ln{|\csc\theta+\cot\theta|}+C$$
now, using the fact that $x=2\sqrt{2}\sec\theta+4$, we have the following identities, based on the definition of the trigonometric functions:
$$\csc\theta=\frac{x-4}{\sqrt{x^2-8x+8}}$$
as well as
$$\cot\theta=\frac{2\sqrt{2}}{\sqrt{x^2-8x+8}}$$
therefore, the final integral is given by:
$$I=-\frac{\sqrt{2}}{4}\ln{\left|\frac{x+2\sqrt{2}-4}{\sqrt{x^2-8x+8}}\right|}+C$$
which, I've been informed, is incorrect. Would anyone be kind enough to help me realize my error? Any responses are appreciated. Thank you.
 A: First of all consider the derivations of the inverse hyperbolic functions as follows

$$(\operatorname{artanh}(x))'=\frac{1}{1-x^2}~\text{for}~|x|<1~~~~(\operatorname{arcoth}(x))'=\frac{-1}{x^2-1}~\text{for}~|x|>1$$

These can be found by using the identity $x'(y)=\frac1{y'(x)}$ and some knowledge concerning the hyperbolic functions. Integrating these equations leads to some nice formulas for integrating fractions of the form $x^2-1$ and $1-x^2$. With these tools one can avoid using a trigonometric subsitution here. 
Especially for your integral we get
$$\begin{align}
\int\frac1{x^2-8x+8}dx&=\int\frac1{(x-4)^2-8}dx\\
&=\frac18\int\frac1{\left(\frac{x-4}{2\sqrt{2}}\right)^2-1}dx\\
&=\frac18\int\frac1{u^2-1}du\\
&=-\frac18\operatorname{artanh}(u)+C\\
&=-\frac18\operatorname{artanh}\left(\frac{x-4}{2\sqrt{2}}\right)+C
\end{align}$$
The only thing you have to care about is when to use the inverse hyperbolic tangent and when to use the inverse hyperbolic cotangent.

By using the definitions of the hyperbolic functions
$$\tanh(x)=\frac{e^x-e^{-x}}{e^x+e^{-x}}~~~\coth(x)=\frac{e^x+e^{-x}}{e^x-e^{-x}}$$
we can verify the following formulas for the inverse functions

$$\operatorname{artanh}(x)=\frac12\ln\frac{1+x}{1-x}~\text{for}~|x|<1~~~\operatorname{arcoth}(x)=\frac12\ln\frac{x+1}{x-1}~\text{for}~|x|>1$$

which can be used to reshape the solution of the integral in terms of the natural logarthim.
A: Your answer is correct and it's only a matter of rewriting.
Let us consider your integral:
$$I=\int\frac{1}{x^2-8x+8}\ dx.$$
I approached this problem by factoring the denominator instead of completing the square:
$$x^2-8x+8=0.$$
The discriminant is given by $\Delta_x=(-8)^2-4(1)(8)=64-32=32$ such that $\sqrt{\Delta_x}=\sqrt{32}=4\sqrt{2}$.
Solutions for $x$ are given by $$x_{1,2}=\frac{-(-8)\pm4\sqrt{2}}{2(1)}=4\pm2\sqrt{2}.$$ 
Thus,
$$x^2-8x+8=(x-4-2\sqrt{2})(x-4+2\sqrt{2}).$$
Next I applied partial fraction decomposition on the integrand:
$$\frac{1}{x^2-8x+8}=\frac{A}{x-4-2\sqrt{2}}+\frac{B}{x-4+2\sqrt{2}}.$$
It follows that
$$1=A(x-4+2\sqrt{2})+B(x-4-2\sqrt{2})=(A+B)(x-4)+(A-B)2\sqrt{2}.$$
It can be derived that $A+B=0$ and $(A-B)2\sqrt{2}=1$ which means that $A=\frac{1}{4\sqrt{2}}$ and $B=-\frac{1}{4\sqrt{2}}$. 
Thus,
$$\frac{1}{x^2-8x+8}=\frac{1}{4\sqrt{2}}\left(\frac{1}{x-4-2\sqrt{2}}-\frac{1}{x-4+2\sqrt{2}}\right).$$
Substitution into your integral gives
$$I=\frac{1}{4\sqrt{2}}\int\left(\frac{1}{x-4-2\sqrt{2}}-\frac{1}{x-4+2\sqrt{2}}\right) dx.$$
Integration yields
$$I=\frac{1}{4\sqrt{2}}\ln\left|\frac{x-4-2\sqrt{2}}{x-4+2\sqrt{2}}\right|+\text{constant}.$$
Okay, so we have arrived at an expression. Let us rewrite it to yield your expression.
Consider
$$I=-\frac{1}{4\sqrt{2}}\ln\left|\left(\frac{x-4-2\sqrt{2}}{x-4+2\sqrt{2}}\right)^{-1}\right|+\text{constant}.$$
It follows that
$$I=-\frac{1}{4\sqrt{2}}\ln\left|\frac{x-4+2\sqrt{2}}{x-4-2\sqrt{2}}\right|+\text{constant}.$$
Within the argument of the natural logarithm; multiply both the denominator and numerator by $x-4+2\sqrt{2}$:
$$I=-\frac{1}{4\sqrt{2}}\ln\left|\frac{x-4+2\sqrt{2}}{x-4-2\sqrt{2}}\frac{x-4+2\sqrt{2}}{x-4+2\sqrt{2}}\right|+\text{constant}.$$
It follows that
$$I=-\frac{1}{4\sqrt{2}}\ln\left|\frac{(x-4+2\sqrt{2})^2}{x^2-8x+8}\right|+\text{constant}.$$
Write $\frac{1}{\sqrt{2}}=\frac{\sqrt{2}}{2}$:
$$I=-\frac{\sqrt{2}}{4}\frac{1}{2}\ln\left|\frac{(x-4+2\sqrt{2})^2}{x^2-8x+8}\right|+\text{constant}.$$
It follows that
$$I=-\frac{\sqrt{2}}{4}\ln\left|\frac{x-4+2\sqrt{2}}{\sqrt{x^2-8x+8}}\right|+\text{constant}.$$
We have obtained your expression.
