3
$\begingroup$

Today we had our CS paper wherein there was a question

convert 24.58 to binary.

None of my friends and myself were able to solve this question. So we thought that maybe 24.58 was irrational in base 2 (because even after debating for about one hour after the exam we weren't able to agree upon a solution.)

  • Is this assumption of of ours correct.

  • Also if it is correct is is possible for some numbers like $\sqrt{2}$ be rational in a base other than decimal

$\endgroup$
  • $\begingroup$ No, it does not. The definition of rational number has nothing to do with its representation (that's where bases come in). $\endgroup$ – Git Gud Apr 1 '17 at 14:34
0
$\begingroup$

As others have said, whether a number is rational or not does not depend on the base that it is written in. There are other quite different ways to write numbers, e.g. continued fractions, but these would not affect the rationality either.

However, the base might affect whether or not the representation terminates. In the familiar base 10, the decimal places for p/q will terminate if and only if the prime factorization of q consists of 2s and 5s only. In base 2, the expression will only terminate if q is a power of 2. So, any number whose base 2 representation terminates will terminate in base 10 as well but there are many that terminate in base 10 that do not terminate in base 2 such as 1/10 and 1/100.

So, that computers often use internal formats based on 2 can cause confusion and errors, particularly with financial calculations. Add up 0.01 (e.g. 1 cent) 100 times and then ask whether it is equal to 1.00 (1 dollar). Using float or double, you will probably get the answer no. The designers of Cobol thought of this and it has formats which get it right.

$\endgroup$
2
$\begingroup$

Whether a number is rational (ratio of two integers) is base-independent; even which ratio you need (in this case $1229/50$) is unchanged. What the base does is determine whether the digits recur or terminate (the latter really means the recurrence is of the digit $0$). In base 10, a third is $0.\dot{3}$; in base 3, it's $0.1$.

$\endgroup$
2
$\begingroup$

A rational number is a pair of integers $(a,b)$ where $b\neq 0$. Instead of writing $(a,b)$, we often write $a/b$ to denote the number. We say two rational numbers $a/b$ and $c/d$ are equal whenever $ad=bc$. Sums and products are defined in the ways in which you are already familiar.

The above definition has nothing to do with base, and hence we can conclude that rational numbers are base-independent (and hence, as in your question, so too is irrationality).

$\endgroup$
1
$\begingroup$

Whether a number is rational or not is a property of the number, not of the representation you choose to write it.

$25.48 = 2548/100$ is rational: it's the quotient of two integers. The "decimal" expansion of a rational number in base $2$ might or might not terminate. If it doesn't, it will eventually repeat.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.