An Analytic Study of Opinion Dynamics in Multi-Agent Systems