A function is one-one (injective) if each output comes from exactly one input. A function is onto (surjective) if every value in the target set is achieved by some input.
To check if f(x)=cosx is one-one, consider:
f(0)=cos(0)=1
f(2π)=cos(2π)=1
Since 0=2π but both give the same output, different inputs produce the same output.
Similarly:
f(π/3)=cos(π/3)=0.5
f(5π/3)=cos(5π/3)=0.5
The function is not one-one.
To check if f(x)=cosx is onto, verify that every value in [−1,1] can be achieved.
The range of cosx is exactly [−1,1]:
cos(0)=1
cos(π/3)=0.5
cos(π/2)=0
cos(2π/3)=−0.5
cos(π)=−1
For any value between −1 and 1, there exists an x value such that cosx equals that value.
The function is onto.
The function is onto but not one-one.