consider the following class of functions defined as:
If $f : \Bbb R \to \Bbb R$ be the function such that $$ f(x)=x|x|-4 :x \in \Bbb Q$$ $$ f(x)=x|x|-\sqrt{3} :x \notin \Bbb Q$$ then $f(x)$ is there a general approach to comment on bijection of this function?
my approach: generally for finding whether a function is one -one/many-one and into/onto I draw graphs and match range with co-domain while also checking if $f'(x)>0$ or $f'(x)<0$ to get answer but here the only method I can think of here is finding an example which makes the function many-one (here $f(2)=f(\sqrt{\sqrt{3}})=0$) and into (clearly $f(x) \neq \sqrt{3}$)
Is there any way which does not require finding counterexamples.kindly help.
To disprove a function being one-one, you do have to come up with a counterexample. (Or at least, show the existence of one.)
While graphing and $f'$ are tools that can help for nice enough functions, you always have the definition to turn back to.
In this case, you could try by assuming $f(x_1) = f(x_2)$ and see where it leads you. This can be done systematically.
Since the function is defined piece-wise, it would make sense to take the following cases:
It is easy to see that both cases 1. and 3. will give you $x_1|x_1| = x_2|x_2|$ which would force $x_1 = x_2$.
So only 2. is to be checked. Here you set up the equation $$x_1|x_1| - 4 = x_2|x_2| - \sqrt3$$ or $$x_2|x_2| = x_1|x_1| - 4 + \sqrt 3.$$ Now, one notes that if the RHS is irrational, then one can find an irrational $x_2$ that satisfies the equation. (Note that the RHS being irrational is not necessary, though.)
An easy way to do that if by putting $x_1 = 0$ or by putting $x_1 = 2$, the latter gives you the counterexample you created.
I agree that this last part did involve some level of "observation" but given how random functions can be, this should be reasonable.