Existence of a continuous function with zeros in a closed set












0














If $E subset mathbb{R}$ is a closed subset show that there is a continuous real-valued function on $mathbb{R}$ such that $f(x) = 0$ if and only if $x in E$.



I've considered trying to show that the preimage of any open or closed set in $mathbb{R}$ must be open or closed, but this didn't seem to get me anywhere.










share|cite|improve this question






















  • The preimage of what?
    – Andrés E. Caicedo
    Nov 29 '18 at 0:59
















0














If $E subset mathbb{R}$ is a closed subset show that there is a continuous real-valued function on $mathbb{R}$ such that $f(x) = 0$ if and only if $x in E$.



I've considered trying to show that the preimage of any open or closed set in $mathbb{R}$ must be open or closed, but this didn't seem to get me anywhere.










share|cite|improve this question






















  • The preimage of what?
    – Andrés E. Caicedo
    Nov 29 '18 at 0:59














0












0








0







If $E subset mathbb{R}$ is a closed subset show that there is a continuous real-valued function on $mathbb{R}$ such that $f(x) = 0$ if and only if $x in E$.



I've considered trying to show that the preimage of any open or closed set in $mathbb{R}$ must be open or closed, but this didn't seem to get me anywhere.










share|cite|improve this question













If $E subset mathbb{R}$ is a closed subset show that there is a continuous real-valued function on $mathbb{R}$ such that $f(x) = 0$ if and only if $x in E$.



I've considered trying to show that the preimage of any open or closed set in $mathbb{R}$ must be open or closed, but this didn't seem to get me anywhere.







real-analysis continuity






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Nov 29 '18 at 0:46









A. SmithA. Smith

385




385












  • The preimage of what?
    – Andrés E. Caicedo
    Nov 29 '18 at 0:59


















  • The preimage of what?
    – Andrés E. Caicedo
    Nov 29 '18 at 0:59
















The preimage of what?
– Andrés E. Caicedo
Nov 29 '18 at 0:59




The preimage of what?
– Andrés E. Caicedo
Nov 29 '18 at 0:59










1 Answer
1






active

oldest

votes


















4














$f(x) = min[text{dist}(x,E),1]$, where $text{dist}(x,E)=inf{|x-y|:yin E}$



Based on comments, we could also more simply use



$g(x) =inf{|x-y|:yin E}$






share|cite|improve this answer



















  • 2




    +1 Why not just the distance?
    – Ethan Bolker
    Nov 29 '18 at 0:52










  • +1: but I suspect the OP won't know what $mbox{dist}(x, E)$ means.
    – Rob Arthan
    Nov 29 '18 at 0:53










  • I think I unconsciously added bounded as a condition when I read the question
    – Dunham
    Nov 29 '18 at 0:54






  • 1




    More interestingly, you can arrange for $f$ to be $C^infty$.
    – Andrés E. Caicedo
    Nov 29 '18 at 1:00












  • Ah, thank you. I actually had the graph of this function in mind when trying to intuitively think about this problem, but couldn't think of a way to mathematically describe it.
    – A. Smith
    Nov 29 '18 at 1:12











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3018000%2fexistence-of-a-continuous-function-with-zeros-in-a-closed-set%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














$f(x) = min[text{dist}(x,E),1]$, where $text{dist}(x,E)=inf{|x-y|:yin E}$



Based on comments, we could also more simply use



$g(x) =inf{|x-y|:yin E}$






share|cite|improve this answer



















  • 2




    +1 Why not just the distance?
    – Ethan Bolker
    Nov 29 '18 at 0:52










  • +1: but I suspect the OP won't know what $mbox{dist}(x, E)$ means.
    – Rob Arthan
    Nov 29 '18 at 0:53










  • I think I unconsciously added bounded as a condition when I read the question
    – Dunham
    Nov 29 '18 at 0:54






  • 1




    More interestingly, you can arrange for $f$ to be $C^infty$.
    – Andrés E. Caicedo
    Nov 29 '18 at 1:00












  • Ah, thank you. I actually had the graph of this function in mind when trying to intuitively think about this problem, but couldn't think of a way to mathematically describe it.
    – A. Smith
    Nov 29 '18 at 1:12
















4














$f(x) = min[text{dist}(x,E),1]$, where $text{dist}(x,E)=inf{|x-y|:yin E}$



Based on comments, we could also more simply use



$g(x) =inf{|x-y|:yin E}$






share|cite|improve this answer



















  • 2




    +1 Why not just the distance?
    – Ethan Bolker
    Nov 29 '18 at 0:52










  • +1: but I suspect the OP won't know what $mbox{dist}(x, E)$ means.
    – Rob Arthan
    Nov 29 '18 at 0:53










  • I think I unconsciously added bounded as a condition when I read the question
    – Dunham
    Nov 29 '18 at 0:54






  • 1




    More interestingly, you can arrange for $f$ to be $C^infty$.
    – Andrés E. Caicedo
    Nov 29 '18 at 1:00












  • Ah, thank you. I actually had the graph of this function in mind when trying to intuitively think about this problem, but couldn't think of a way to mathematically describe it.
    – A. Smith
    Nov 29 '18 at 1:12














4












4








4






$f(x) = min[text{dist}(x,E),1]$, where $text{dist}(x,E)=inf{|x-y|:yin E}$



Based on comments, we could also more simply use



$g(x) =inf{|x-y|:yin E}$






share|cite|improve this answer














$f(x) = min[text{dist}(x,E),1]$, where $text{dist}(x,E)=inf{|x-y|:yin E}$



Based on comments, we could also more simply use



$g(x) =inf{|x-y|:yin E}$







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Nov 29 '18 at 0:56

























answered Nov 29 '18 at 0:51









DunhamDunham

2,084613




2,084613








  • 2




    +1 Why not just the distance?
    – Ethan Bolker
    Nov 29 '18 at 0:52










  • +1: but I suspect the OP won't know what $mbox{dist}(x, E)$ means.
    – Rob Arthan
    Nov 29 '18 at 0:53










  • I think I unconsciously added bounded as a condition when I read the question
    – Dunham
    Nov 29 '18 at 0:54






  • 1




    More interestingly, you can arrange for $f$ to be $C^infty$.
    – Andrés E. Caicedo
    Nov 29 '18 at 1:00












  • Ah, thank you. I actually had the graph of this function in mind when trying to intuitively think about this problem, but couldn't think of a way to mathematically describe it.
    – A. Smith
    Nov 29 '18 at 1:12














  • 2




    +1 Why not just the distance?
    – Ethan Bolker
    Nov 29 '18 at 0:52










  • +1: but I suspect the OP won't know what $mbox{dist}(x, E)$ means.
    – Rob Arthan
    Nov 29 '18 at 0:53










  • I think I unconsciously added bounded as a condition when I read the question
    – Dunham
    Nov 29 '18 at 0:54






  • 1




    More interestingly, you can arrange for $f$ to be $C^infty$.
    – Andrés E. Caicedo
    Nov 29 '18 at 1:00












  • Ah, thank you. I actually had the graph of this function in mind when trying to intuitively think about this problem, but couldn't think of a way to mathematically describe it.
    – A. Smith
    Nov 29 '18 at 1:12








2




2




+1 Why not just the distance?
– Ethan Bolker
Nov 29 '18 at 0:52




+1 Why not just the distance?
– Ethan Bolker
Nov 29 '18 at 0:52












+1: but I suspect the OP won't know what $mbox{dist}(x, E)$ means.
– Rob Arthan
Nov 29 '18 at 0:53




+1: but I suspect the OP won't know what $mbox{dist}(x, E)$ means.
– Rob Arthan
Nov 29 '18 at 0:53












I think I unconsciously added bounded as a condition when I read the question
– Dunham
Nov 29 '18 at 0:54




I think I unconsciously added bounded as a condition when I read the question
– Dunham
Nov 29 '18 at 0:54




1




1




More interestingly, you can arrange for $f$ to be $C^infty$.
– Andrés E. Caicedo
Nov 29 '18 at 1:00






More interestingly, you can arrange for $f$ to be $C^infty$.
– Andrés E. Caicedo
Nov 29 '18 at 1:00














Ah, thank you. I actually had the graph of this function in mind when trying to intuitively think about this problem, but couldn't think of a way to mathematically describe it.
– A. Smith
Nov 29 '18 at 1:12




Ah, thank you. I actually had the graph of this function in mind when trying to intuitively think about this problem, but couldn't think of a way to mathematically describe it.
– A. Smith
Nov 29 '18 at 1:12


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3018000%2fexistence-of-a-continuous-function-with-zeros-in-a-closed-set%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mont Emei

Province de Neuquén

Soliste