I think that what I am now going to write about the basic definitions has been said before on this thread, by various different posters but I just want to put it together. (I do this for living, there are witnesses who can testify that I can apply the Pumping Lemmas of regular and context-free languages while drunk. And I have arranged the regular PL as a polka).
The basic mathematical definitions start from sets. A set is a collection of elements. Now, what the previous sentence means philosophically is something that I leave to set theorists as I do with the sets not containing itself and all that stuff.
What suffices now is that a set can be written in using various different notations, the most important being:
1. Enumerating all elements in it, for example:
S_1 = { 0, 1, 2, green, red, apple, the moon }
S_2 = { 0, 1, 2, ... }
The first example is finite, the second infinite.
2. Expressing them via some condition (predicate)
S_3 = { x | x is a prime number }
A relation is a mathematical way of associating the elements of sets with each other. This is done via the cartesian product of the sets. The cartesian product of two sets is the set of all ordered pairs that can be formed from their elements.
For example, if
A = { a, b }
B = { 1, 2 },
then their cartesian product is:
A x B = { (a, 1), (a, 2), (b, 1), (b, 2) } .
A relation is formally a subset of a cartesian product. For example, we could define a relation R in A x B as:
R = { (a, 1), (a, 2), (b, 1) }.
Of course, this relation is rather pointless, so we could try another, more practical one.
Consider the set of early Roman emperors:
E = { caesar, augustus, tiberius, gaius, claudius, nero }
and define the relation A on E x E with the idea that the pair (x, y) belongs to A if x is the adopted son of y. Then we have:
A = { (caesar, augustus), (augustus, tiberius), (gaius, tiberius), (nero, claudius) }.
Or we could use a more mathematical definition of examining the set N of natural numbers and the "less than" relation. Then,
< = { (0,1), (0,2), (1,2), (0,3), (1,3), (2,3), ... }
So, basically we write x < y if and only if (x, y) belongs in <.
Now, a function is a relation that fulfills one additional condition: for each element of the first set there is exactly one pair in the relation. (Some category theorists may want to define it in another way but hopefully none of us are category theorists. (I took one course on it and I'm actively trying to forget anything that I learned on it)).
None of the earlier example relations are functions: R has two pairs for a, A has no pair for Claudius, and < has an infinite number of pairs for all elements.
An example function could be the successor function s(x) = x+1:
s = { (0,1), (1,2), (2, 3), ... }
(The A relation is a partial function as all emperors have at most one adoptive father).
Mathematically it doesn't matter a bit what the sets are and what the relations are. If the relation has exactly one pair for each element of the first set, then it is a function. If it hasn't it isn't.
Now, how does this relate with the square root. Well, you have several possible ways to define the square root such that it is a function. Basically you choose what the domain and the range of the function are. (In the following R is the set of real numbers, R+ the set of positive numbers, and C the set of complex nunbers).
Sqrt_1 : R+ -> R+
Sqrt_2: R+ -> R+ x R-
Sqrt_3: C -> C x C
Or you might not even want to force the square root to be a function at all but you are comfortable in it being a relation on R+ x R or C x C, that is certainly one consistent way of thinking it.
What definition you want to use depends on what you want to do. Sqrt_1 is in practical life usually the most convenient one. And if someone doesn't believe that there is a place for convenience in mathematics, then I suggest that someone to start reading articles written by elderly German mathematicians of the 19th century.( Or of the 20th century, even, there was one 1990-something paper where I couldn't understand a bit because that particular professor used heavily outdated notation combined with total lack of examples or explanations.)
One good point in Sqrt_1 is that it mixes well with arithmetic operators: if you want to compose operators (meaning that you want to write stuff like 5 * ( 2 + 4)), then everything that you have should operate on the same domains and ranges. (Well, same except that it is not a problem if the operators take different numbers of arguments). Of course, you could define the operations so that, for example, addition would work for sets of numbers but that would be mightily confusing to everybody, including you.
However, Sqrt_1 is not good enough for all uses. If you want to find the roots of a second order polynomial, then you have to consider also the negative roots. Or complex roots when you get into more complex problems.
So, my point is that you should use the definition that is the best for the problem that you are trying to solve.
Long-time experience of mathematicians indicate that it makes sense to restrict the square root symbol to denote only the positive root when the argument is a positive real (and when we are not using complex numbers). Convenience is very important in mathematics, otherwise we would still be using Roman numerals for everything.