It's possible they're not closely related at all. Your Hamilton family was in Massachusetts since before 1700. Alexander Hamilton's family didn't arrive in the U.S. until just before the American Revolution. You might be able to find a connection back in Scotland many, many generations ago but that will take some work and a bit of time.