Let's call Ali's age "x".
Then, Hassan's age would be "2x", since Hassan is twice as old as Ali.
And if their ages add up to 39 years, we can write the equation:
x + 2x = 39
Expanding the equation, we get:
3x = 39
And finally, solving for x:
x = 13
So, Ali is 13 years old and Hassan is 26 years old