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?
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}