Processing math: 100%
Google
 
Web unafbapune.blogspot.com

Sunday, October 28, 2012

 

Drawing Function vs Fitting Model in R

layout(matrix(c(1,2), 1,2, byrow=TRUE))

# http://www.stat.umn.edu/geyer/5102/examp/reg.html
qftn <- function(x) x^2 * 3
curve(qftn, 1, 3, main = "Function: y = x^2 * 3") 

x <- c(1:3)
y <- c(3, 12, 27)
plot(x, y, main="Fitting model: y = x^2 * 3")
model <- lm(y ~ I(x^2 * 3))
curve(predict(model, newdata = data.frame(x = x)), add = TRUE)
# May also draw the coordinate pairs, like so:
text(1,4, "(1,3)")
text(2,13, "(2,12)")
text(2.9,27, "(3,27)")


Wednesday, October 24, 2012

 

Goldbach Conjecture and odd numbers > 5

Prove that if every even natural number greater than 2 is a sum of two primes (the Goldbach Conjecture), then every odd natural number greater than 5 is a sum of three primes.









== Solution ==

This is equivalent to asking if every even natural number greater than 2 is a sum of two primes,
  (nNn>1)(p,qP)[p+q=2n]
is it true that:
  (mNm>2)(r,s,tP)[r+s+t=2m+1]
Exploiting m > 2 and n > 1:
  (mNm>2)(xN)[x=m1>1]m=x+1>2
Now,
  2m+1=2(x+1)+1=2x+3
But x is greater than 1 which means 2x is an even number greater than 2, and therefore is a sum of two primes. Since 3 is prime, (2m + 1), an arbitrary odd natural number greater than 5, is therefore a sum of three primes.


Tuesday, October 23, 2012

 

Composite f(n)=n2+bn+c

Prove that there is a quadratic f(n)=n2+bn+c, with positive integers coefficients b, c, such that f(n) is composite (i.e, not prime) for all positive integers n, or else prove that the statement is false.









== Attempt ==
  f(n)=n2+bn+c=(n2+b2)2b24+c
This means when
  c=b24
Then,
  f(n)=(n2+b2)2
which is composite !

 

12|n and 12|n3

Prove or disprove the statement “An integer n is divisible by 12 if and only if n3 is divisible by 12.”









== Solution ==

If integer n is divisible by 12, for some integer m:
  n=12mn3=123m3
Clearly, n3 is divisible by 12. How about the converse ? Is n divisible by 12 if n3 is divisible by 12 ? Note 12=22×3, so one counter example would be:
  n3=2333=1218n=23=6
In other words, n3 is divisible by 12, but not n. Hence the converse is false.


Monday, October 22, 2012

 

Prove 3 is irrational

Prove that 3 is irrational.









== Attempt ==

First, let's prove the lemma that if the square of an integer n is divisible by 3, n must be divisible by 3. Why ? A integer can be written in only one of 3 forms:
  Case 1:n=3xCase 2:n=3x+1Case 3:n=3x+2
where x is an integer. If we take the square of n in each case:
  Case 1:n2=(3x)2=9x2Case 2:n2=(3x+1)2=9x2+6x+1=3(3x2+2x)+1Case 3:n2=(3x+2)2=9x2+12x+4=3(3x2+4x+1)+1
Note that only in case 1 when n is divisible by 3 would n2 be divisible by 3. This completes the proof of the lemma.

Now suppose 3 is rational,
  p,qN[3=pq]
such that p and q has no common factors. Squaring both sides,
  3=p2q23q2=p2
This means p2 is divisible by 3. By the above lemma, this means p must be divisible by 3. Or p = 3r for some integer r.
  3q2=p2=(3r)2=9r2q2=3r2
This means q2 is divisible by 3, and by the lemma above, q must be divisible by 3. To summarize, both p and q are divisible by 3, but this contradicts the initial assumption that p and q has no common factor!

Hence 3 is irrational.


Sunday, October 21, 2012

 

Proof of perfect square

Prove or disprove the claim that for any positive integer m there is a positive integer n such that mn + 1 is a perfect square.









== Attempt ==

First, the claim can be expressed as:
  (m,nN)(rZ)[mn+1=r2]
Observe that:
  mn+1=r2mn=r21mn=(r+1)(r1)n=(r+1)(r1)m
This means if the claim is true, m must divide either (r + 1) or (r - 1):
  (xN)[(mx=r+1)(mx=r1)]
Or,
  (xN)[(r=mx1)(r=mx+1)]
For example, when m = 1, the smallest value of r such that n > 0 would be when x = 3. So:
  r=131=2n=(2+1)(21)1=3mn+1=13+1=22
Given m >= 1, we can always pick a value x such that:
  r=mx1>=2
This is when:
  x>=3m
which means we can always find a value r (from m and x) and n (from r and m) that satisfies the claim. This completes the proof.


Thursday, October 18, 2012

 

What's the laziest possible thing a programmer can do ?

Ask the above question ! Or, in short, recursion :)


This page is powered by Blogger. Isn't yours?