How are mathematical properties discovered and proved? Consider property of the logarithm:
$$\log_{b}x^n = n\cdot \log_{b}x$$
My question is, how was this property (and in general, any other property in mathematics) discovered and proved?
Did they just try using random values of $x$,$n$ and $b$ until they realized that property above holds no matter what values we use, or there is an algebraic way of proving it? 
 A: The expression $\log_b x$ is asking "$b$ to what power equals $x$?" If $b^\bigstar = x$, then surely 
$$b^{n\bigstar} = (b^\bigstar)^n = x^n.$$
This tells us that $$\log_b(x^n) = n \bigstar = n \log_b(x).$$
(I'm assuming above that $b > 1, x > 0$.)
So, facts like this are discovered in part just by understanding what the relevant expressions mean and thinking things through carefully. It always helps to try examples and notice patterns. If a fact is out there waiting to be discovered, and if we search obsessively, eventually we will stumble over the fact and figure out how to understand it.
A: $$\log_b(b^m)=m\\x=b^z\implies x^n=(b^z)^n\\(b^z)^n=b^{zn}\implies \log_b(x^n)=zn=n\cdot \log_b(x)$$
So if you believe the exponent rules, and know the definition of a log, you get it being forced. See https://en.m.wikipedia.org/wiki/Mathematical_proof for more. 
A: Firstly, it's not true.
For example, $$\log_2x^2=2\log_2|x|$$ and
$$\log_2x^2\neq2\log_2x.$$
For $x>0$, $b>0$ and $b\neq1$ by the definition of $\log$ we have:
$$b^{\log_b{x^n}}=x^n=\left(b^{\log_bx}\right)^n=b^{n\log_bx}$$ and from here we get the needed property.
A: We observe some regularities and patterns, capture them with definitions, observe dependencies among various definitions and axioms and concepts, and then try to prove or disprove them.
The better you understand some branch the more likely is that you will be able to do a research inside that branch and to discover some laws.
However, it is not easy to master all the branches, some say that Poincare was the last "universalist", meaning that he mastered almost all branches and made an impact in almost all of them.
There are also people, like was Galois, who studied specific general problem and had brilliant ideas that were later successfully generalized and accepted and, if he had more time, probably would also become an "universalist".
The only recipe that I know of on how to discover laws is to have a very good understanding of the definitions, concepts, methods of proof and disproof, and, experimentation can be helpful, especially in number theory.
And how to have a very good understanding is a question that is not always easy to answer.
