How does taking the log of the variable solve our problem of heteroscedasticity? I have been taking online classes on linear regression, and in that the instructor told that heteroscedasticity can be solved by taking log of the variables, I was not much acquainted with the intuition behind logs, but a quick google search lent me the answer that, suppose if i have log 9 with base 3 , my answer will be 2, so log tells me what power is my base(3) raised to to get the answer 9.
So how is it that when we apply log to our variables, we solve the problem of heteroscedasticity? Can someone please explain me the intuition and technical and logical thinking behind it?
 A: If the variance of the errors is proportional to the expected value then a logarithmic transform  transform is appropriate. Other possible relationships between the first and the second moment would suggest another form of transformation. See When (and why) should you take the log of a distribution (of numbers)? and a spirited discussion here on SE Why do sample ACF/PACF suggest different TS models after box-cox transformation?,
Note that the variance of a series may change at particular points in time (if you have time series data or spatial data) and that conclusion would suggest Weighted Least Squares as detailed by Tsay here http://docplayer.net/12080848-Outliers-level-shifts-and-variance-changes-in-time-series.html.
In case one encounters possible anomalies one should treat them /isolate their effect/ mitigate their effect so they don't distort the empirical identification of any needed variance-stabilizing transform . Failure to do  so this lead to a misleading log transforms of the classic Airline Series as pointed out by Chatfield and Prothero and elsewhere by Prof. Spyros Makridakis.
Transformations are like drugs ... "Some are good for you and some aren't !"
