The essential bandwidth of a rectangular pulse
First note that $$\mathcal{F}\{\mathrm{rect}(\frac{t}{T})\}=T\mathrm{sinc}(Tf)=\frac{\sin(\pi Tf)}{\pi f}$$ 
Then you have correctly calculated the pulse energy as $$E_g=\int_{-\infty}^{+\infty}g^2(t)dt=T$$
Now we want to find $B$ such that
$$\int_{-B}^{B}T^2\mathrm{sinc}^2(Tf)df=0.9T$$
or since the function is even,
$$\int_{0}^{B}T\mathrm{sinc}^2(Tf)df=0.45$$ which by assuming $$Tf=x\Rightarrow df=dx/T$$ is 
$$\int_{0}^{TB}\mathrm{sinc}^2(x)dx=0.45$$
Using the following code we get the essential bandwidth $$\bbox[0.5em,#efe,border:0.1em groove navy]{\
B\approx\frac{0.8455}{T}\
}$$

J = 0.45; %target value
acceptable_error = 1e-4;
dx = 1e-5;
xmax = 1; %initial guess
max_iterations = 100;
iteration = 0;
while iteration &lt; max_iterations;
    x = 0:dx:xmax;
    y=sinc(x).^2;
    I = trapz(x,y);
    if abs(I-J) &lt;= acceptable_error
        break;
    end
    if I &lt; J
        xmax = 3/2*xmax;
    else
        xmax = xmax/2;
    end
    iteration = iteration+1;
end
fprintf('absolute error = %f\n',abs(I-J));
fprintf('solution = %f\n',xmax)