function root = bisection(a,b,tol)
%BISECTION METHOD - Modify function below, then can 
%   find its roots in [a,b] to tolerance tol
f = @(x) (x/2).^2 - sin(x);
while (abs(b-a) >= tol)
    m = (a+b)/2;
    if (f(m) == 0)
        break;
    elseif(f(b)*f(m) < 0)
        a = m;
    else
        b = m;
    end
end
root = m;
end

