Intuitively, a function is a rule that takes something as an input and gives an output. It can also be stated as that a function is a rule that maps elements from a set to the elements of a different or the same set. Both the above statement can be regarded as almost same. Everything was a fine till I came to know the set-theoritic definition of a function.
According to that, a function is a set of ordered pairs such that all the first component of pairs which come from the same set, is related to the second component of pairs which also come from a common set. But function is like something I stated above and set is just a collection of things having something common. How can set do the work of function?
I understand that each function can correspond to a set of oredered pairs in which first component is input and second component is the output but still set can't be thought same as a function. Function is a rule. Set is just a collection. How does the intuition of function connect to the set theoritic definition of function?
Apologies if I sound like a overthinker.
Thanking in advance.
EDIT: Function takes something and if function is defined as a set that it should behave in the same way but set does not behave in that way.
Also, I think that the definition might be for checking whether something is function or not. Since we can create a unique set out of every function, so may be the definition is not for defining what a function is (because we understand that informally) but for defining what can be a function.