Limit of multiple absolute values Let $f(x) = \frac{x^2+2x-3|1-x^2|+1}{2|x+1|-|x^2+x|}$. Find $\lim_{x\rightarrow -1}f(x)$.
I broke up each absolute value into parts:
$|1-x^2| =  \begin{cases} 
      1-x^2 & -1 \leq x\leq 1 \\
      -(1-x^2) & x>1,x<-1
   \end{cases}
$ ,
$|x+1| =  \begin{cases} 
      x+1 & x\geq -1 \\
      -(x+1) & x<-1
   \end{cases}
$,
$|x^2+x| =  \begin{cases} 
      x^2+x & x\geq0,x\leq -1 \\
      -(x+1) & -1<x<0
   \end{cases}
$
Thus, when $x\rightarrow -1$, the function will approach the positive value, because by my definitions of the absolute values,each has the positive value at $x=-1$. So then you can take
$\lim_{x\rightarrow -1}\frac{x^2+2x-3|1-x^2|+1}{2|x+1|-|x^2+x|}=\lim_{x\rightarrow -1}\frac{x^2+2x-3(1-x^2)+1}{2(x+1)-(x^2+x)}=\lim_{x\rightarrow -1}\frac{(4x-2)(x+1)}{(x+1)(-x+2)}=-2$.
But looking at the graph, the limit is -6. So I must have messed up in my absolute value declarations, most likely in the third one.
So, how would I correctly declare and solve this limit?
 A: Note that\begin{align}\require{cancel}f(x)&=\frac{x^2+2x-3|1-x^2|+1}{2|x+1|-|x^2+x|}\\&=\frac{|x+1|^{\cancel2}-3\cancel{|x+1|}|x-1|}{\cancel{|x+1|}(2-|x|)}\\&=\frac{|x+1|-3|x-1|}{2-|x|}\\&\to_{x\to-1}\frac{-6}1\\&=-6.\end{align}
A: As an alternative, we have that by $x=y-1$ with $y\to 0$
$$\frac{x^2+2x-3|1-x^2|+1}{2|x+1|-|x^2+x|}=\frac{y^2-3|2y-y^2|}{2|y|-|y(y-1)|}=\frac{|y|-3|2-y|}{2-|y-1|}\to \frac{0-6}{2-1}=-6$$
A: $f(x) = \frac{x^2+2x-3|1-x^2|+1}{2|x+1|-|x^2+x|}$
$\lim_{x\rightarrow -1^-}f(x)=\lim_{x\rightarrow -1^-}\frac{x^2+2x-3|1-x^2|+1}{2|x+1|-|x^2+x|}=\lim_{x\rightarrow -1^-} \frac{x^2+2x-3(x^2-1)+1}{2(-(x+1))-(x^2+x)}=\lim_{x\rightarrow -1^-}f(x)\frac{-2x^2+2x+4}{-x^2-3x-2}=\lim_{x\rightarrow -1^-} \frac{-2(x+1)(x-2)}{-(x+1)(x+2)}=\lim_{x\rightarrow -1^-} \frac{-2(x-2)}{-(x+2)}=-6$.
$\lim_{x\rightarrow -1^+}f(x)=\lim_{x\rightarrow -1^+}\frac{x^2+2x-3|1-x^2|+1}{2|x+1|-|x^2+x|}=\lim_{x\rightarrow -1^+} \frac{x^2+2x-3(1-x^2)+1}{2(x+1)-(-(x^2+x))}=\lim_{x\rightarrow -1^+}f(x)\frac{4x^2+2x-2}{x^2+3x+2}=\lim_{x\rightarrow -1^+} \frac{2(2x-1)(x+1)}{(x+1)(x+2)}=\lim_{x\rightarrow -1^+} \frac{2(2x-1)}{(x+2)}=-6$.
